Skip to content

Commit

Permalink
Linear XP Scaling for AA and EIO Machines
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Aug 4, 2024
1 parent 3b59535 commit 63256bf
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 3 deletions.
7 changes: 7 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ dependencies {
// Controlling (from CurseForge)
compileOnly rfg.deobf("curse.maven:controlling-250398:5165715") // Version 3.0.12.3

// Actually Additions (from CurseForge)
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // Version r152

// Default World Generator Port (from CurseForge)
compileOnly rfg.deobf("curse.maven:default-world-generator-port-241140:2499252") // Version 2.3

Expand Down Expand Up @@ -250,6 +253,10 @@ dependencies {
runtimeOnly "curse.maven:top-addons-247111:2887479" // Version 1.13.0
}

if (project.enable_aa.toBoolean()) {
runtimeOnly "curse.maven:actually-additions-228404:3117927" // Version r152
}

if (project.enable_ender_storage.toBoolean()) {
// Ender Storage, runtime only, integrated in remappers (from CurseForge)
runtimeOnly "curse.maven:ender-storage-245174:2755787" // Version 2.4.6.137
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ enable_storage_drawers = false
# Requires `enable_storage_drawers` to be set to true.
enable_framed_compact = false

# Whether to enable Ender IO and its deps in runtime. Enables Custom Capacitors.
# If this is set to false, custom capacitors are disabled.
# Whether to enable Ender IO and its deps in runtime. Enables Custom Capacitors & allows specifying Linear XP Scaling for EIO Machines.
enable_ender_io = false

# Whether to enable Chisel and its deps in runtime. Enables Chisel Blocks in Naq Reactors.
Expand Down Expand Up @@ -283,6 +282,9 @@ enable_default_world_gen_port = false
# Whether to enable TOP Addons in runtime. Fixes Error Messages with Architecture Craft 3.108.
enable_top_addons = false

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

# 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
Expand Down
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 @@ -30,6 +30,7 @@ public class LabsValues {
public static final String STORAGE_DRAWERS_MODID = "storagedrawers";
public static final String FRAMED_COMPACT_MODID = "framedcompactdrawers";
public static final String ENDER_IO_MODID = "enderio";
public static final String AA_MODID = "actuallyadditions";
public static final String JEI_MODID = "jei";
public static final String ROCKETRY_MODID = "advancedrocketry";
public static final String ARCHITECTURE_MODID = "architecturecraft";
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ public static class Advanced {
@Config.LangKey("config.nomilabs.advanced.disable_xp_scaling")
public boolean disableXpScaling = false;

@Config.Comment({ "Amount of XP Per Level, for Linear XP Scaling.",
"Used for Linear XP Scaling in Actually Additions and EIO Machines.",
"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.RequiresMcRestart
@Config.RangeInt(min = 0)
public int aaEioLinearXp = 0;

@Config.Comment({ "Whether to disable the Narrator.",
"Fixes Crashes in Arm Macs, in some very specific environments.",
"If your game is crashing, try enabling this!",
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public class LabsLateMixin implements ILateMixinLoader {
new AbstractMap.SimpleImmutableEntry<>(LabsValues.TOP_ADDONS_MODID,
LabsConfig.modIntegration.enableTopAddonsIntegration),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.TOP_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.AE2_MODID, true))
new AbstractMap.SimpleImmutableEntry<>(LabsValues.AE2_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.ENDER_IO_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.AA_MODID, true))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.nomiceu.nomilabs.mixin.actuallyadditions;

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 de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;

@Mixin(value = TileEntityXPSolidifier.class, remap = false)
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);
}

@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);
}

@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);
}
}
32 changes: 32 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/mixin/enderio/XPUtilMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.nomiceu.nomilabs.mixin.enderio;

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 crazypants.enderio.base.xp.XpUtil;

@Mixin(value = XpUtil.class, remap = false)
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));
}

@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));
}

@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);
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/nomilabs/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +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.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.actuallyadditions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"package": "com.nomiceu.nomilabs.mixin.actuallyadditions",
"refmap": "mixins.nomilabs.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"TileEntityXPSolidifierMixin"
],
"client": [],
"server": []
}
12 changes: 12 additions & 0 deletions src/main/resources/mixins.nomilabs.enderio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"package": "com.nomiceu.nomilabs.mixin.enderio",
"refmap": "mixins.nomilabs.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"XPUtilMixin"
],
"client": [],
"server": []
}

0 comments on commit 63256bf

Please sign in to comment.