Skip to content

Commit

Permalink
Thermal Tome of Knowledge Linear XP
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Aug 13, 2024
1 parent 4427c5f commit 6228d07
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 21 deletions.
8 changes: 7 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ dependencies {
// Inventory BogoSorter (from CurseForge)
compileOnly rfg.deobf("curse.maven:inventory-bogosorter-632327:5162169") // Version 1.4.8

// Thermal Foundation (from CurseForge)
compileOnly "curse.maven:thermal-foundation-222880:2926428" // Version 2.6.7.1

// CoFH Core (compile time dep of Thermal Foundation) (from CurseForge)
compileOnly "curse.maven:cofh-core-69162:2920433" // Version 4.6.6.1

/* -------------------------------- Soft Deps, Multiple Runtime Declaration -------------------------------- */
if (project.enable_draconic.toBoolean() || project.enable_thermal.toBoolean()) {
runtimeOnly "curse.maven:redstone-flux-270789:2920436" // Version 2.1.1.1
Expand Down Expand Up @@ -275,7 +281,7 @@ dependencies {
}

if (project.enable_thermal.toBoolean()) {
// Thermal Expansion and Deps (Thermal Foundation, Redstone Arsenal, CoFH World, CoFH Core), runtime only, used in excitation coil texture (from CurseForge)
// Thermal Expansion, Thermal Foundation, CoFH Core and Deps (Redstone Arsenal, CoFH World) (from CurseForge)
runtimeOnly "curse.maven:thermal-expansion-69163:2926431" // Version 5.5.7.1
runtimeOnly "curse.maven:thermal-foundation-222880:2926428" // Version 2.6.7.1
runtimeOnly "curse.maven:redstone-arsenal-70631:2939416" // Version 2.6.6.1
Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,19 @@ enable_default_world_gen_port = false
enable_top_addons = false

# Whether to enable Actually Additions in runtime. Allows specifying Linear XP Scaling for AA Machines.
enable_aa = false
enable_aa = true

# Whether to enable Ender Storage in runtime. Enables remappers to remap items in ender storage.
# If this is set to false, the remappers will not apply there.
enable_ender_storage = false

# Whether to enable Inventory BogoSorter in runtime. Fixes duplication glitch with Thermal Satchels.
enable_bogo = false
enable_bogo = true

# Whether to enable Thermal Expansion and its deps in runtime. These are used for the excitation coil textures.
# Also sets the Tome of Experience to have Linear XP Scaling.
# If this is set to false, the top of the excitation coil will have a null texture.
enable_thermal = false
enable_thermal = true

# Whether to enable Mouse Tweaks in runtime. Useful for testing interactions with various GUIs.
enable_mouse_tweaks = false
1 change: 1 addition & 0 deletions src/main/java/com/nomiceu/nomilabs/LabsValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ public class LabsValues {
public static final String PACK_MODE_MODID = "packmode";
public static final String AE2_STUFF_MODID = "ae2stuff";
public static final String BOGOSORT_MODID = "bogosorter";
public static final String THERMAL_FOUNDATION_MODID = "thermalfoundation";
}
7 changes: 4 additions & 3 deletions src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,15 @@ public static class Advanced {
public boolean syncDimProperties = false;

@Config.Comment({ "Amount of XP Per Level, for Linear XP Scaling.",
"Used for Linear XP Scaling in Actually Additions and EIO Machines.",
"Used for Linear XP Scaling in Actually Additions, EIO and Thermal Items/Machines.",
"Note that for Thermal, XP fixes are only applied for the Tome of Knowledge, not for any machines associated with Essence of Knowledge.",
"MUST be used in conjunction with UT's Linear XP Scaling Config, else weird issues may happen!",
"Enter a value of 0 for default.",
"[default: 0]" })
@Config.LangKey("config.nomilabs.advanced.aa_eio_linear_xp")
@Config.LangKey("config.nomilabs.advanced.other_mods_linear_xp")
@Config.RequiresMcRestart
@Config.RangeInt(min = 0)
public int aaEioLinearXp = 0;
public int otherModsLinearXp = 0;

@Config.Comment({ "Whether to disable the Narrator.",
"Fixes Crashes in Arm Macs, in some very specific environments.",
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public class LabsLateMixin implements ILateMixinLoader {
new AbstractMap.SimpleImmutableEntry<>(LabsValues.AE2_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.ENDER_IO_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.AA_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.BOGOSORT_MODID, true))
new AbstractMap.SimpleImmutableEntry<>(LabsValues.BOGOSORT_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.THERMAL_FOUNDATION_MODID, true))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ public abstract class TileEntityXPSolidifierMixin {

@Inject(method = "getExperienceForLevel", at = @At("HEAD"), cancellable = true)
private static void getLinearXpAmountLevel(int level, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.aaEioLinearXp * level);
if (LabsConfig.advanced.otherModsLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.otherModsLinearXp * level);
}

@Inject(method = "getLevelForExperience", at = @At("HEAD"), cancellable = true)
private static void getLinearXPAmountXp(int experience, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && experience >= 0)
cir.setReturnValue(experience / LabsConfig.advanced.aaEioLinearXp);
if (LabsConfig.advanced.otherModsLinearXp != 0 && experience >= 0)
cir.setReturnValue(experience / LabsConfig.advanced.otherModsLinearXp);
}

@Inject(method = "getXpBarCapacity", at = @At("HEAD"), cancellable = true)
private static void getLinearXPAmount(int level, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.aaEioLinearXp);
if (LabsConfig.advanced.otherModsLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.otherModsLinearXp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ public class XPUtilMixin {

@Inject(method = "calculateXPfromLevel", at = @At("HEAD"), cancellable = true)
private static void calculateXpFromLevelLinear(int level, CallbackInfoReturnable<Long> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && level >= 0)
cir.setReturnValue(((long) LabsConfig.advanced.aaEioLinearXp * level));
if (LabsConfig.advanced.otherModsLinearXp != 0 && level >= 0)
cir.setReturnValue(((long) LabsConfig.advanced.otherModsLinearXp * level));
}

@Inject(method = "getLevelFromExp", at = @At("HEAD"), cancellable = true)
private static void getLevelFromXpLinear(long exp, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && exp >= 0)
cir.setReturnValue((int) (exp / LabsConfig.advanced.aaEioLinearXp));
if (LabsConfig.advanced.otherModsLinearXp != 0 && exp >= 0)
cir.setReturnValue((int) (exp / LabsConfig.advanced.otherModsLinearXp));
}

@Inject(method = "getXpBarCapacity", at = @At("HEAD"), cancellable = true)
private static void getLinearXPAmount(int level, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.aaEioLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.aaEioLinearXp);
if (LabsConfig.advanced.otherModsLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.otherModsLinearXp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.nomiceu.nomilabs.mixin.thermalfoundation;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import com.nomiceu.nomilabs.config.LabsConfig;

import cofh.thermalfoundation.item.tome.ItemTomeExperience;

/**
* Applies Linear XP Scaling to Thermal Tomes.
*/
@Mixin(value = ItemTomeExperience.class, remap = false)
public class ItemTomeExperienceMixin {

@Inject(method = "getTotalExpForLevel", at = @At("HEAD"), cancellable = true)
private static void getLinearXp(int level, CallbackInfoReturnable<Integer> cir) {
if (LabsConfig.advanced.otherModsLinearXp != 0 && level >= 0)
cir.setReturnValue(LabsConfig.advanced.otherModsLinearXp * level);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/nomilabs/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ config.nomilabs.advanced=Advanced Settings
config.nomilabs.advanced.tooltip=Advanced Settings
config.nomilabs.advanced.allow_other_modes=Allow Other Modes
config.nomilabs.advanced.disable_xp_scaling=Disable Anvil XP Scaling
config.nomilabs.advanced.aa_eio_linear_xp=Actually Additions & EIO Linear XP
config.nomilabs.advanced.other_mods_linear_xp=Misc Mod Linear XP Support
config.nomilabs.advanced.disable_narrator=Disable Narrator
config.nomilabs.advanced.enable_nomi_ceu_data_fixes=Enable Nomi-CEu Specific Data Fixes
config.nomilabs.advanced.ignore_items=ITEM Missing Registry Ignore List
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/mixins.nomilabs.thermalfoundation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"package": "com.nomiceu.nomilabs.mixin.thermalfoundation",
"refmap": "mixins.nomilabs.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"ItemTomeExperienceMixin"
],
"client": [],
"server": []
}

0 comments on commit 6228d07

Please sign in to comment.