From 932bb6323707eff9933e011d17cd2693df03586a Mon Sep 17 00:00:00 2001 From: Sam Kirby Date: Fri, 23 Aug 2019 09:43:33 +0100 Subject: [PATCH] BiomeTweaker - constant mixins Remove hardcoded biome ID limit in this mod --- .../biometweaker/MixinBiomeColorMappings.java | 14 ++++++++++++++ .../biometweaker/MixinBiomeHelper.java | 19 +++++++++++++++++++ .../resources/mixins.jeid.modsupport.json | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeColorMappings.java create mode 100644 src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeHelper.java diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeColorMappings.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeColorMappings.java new file mode 100644 index 0000000..7367b8a --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeColorMappings.java @@ -0,0 +1,14 @@ +package org.dimdev.jeid.mixin.modsupport.biometweaker; + +import me.superckl.biometweaker.util.BiomeColorMappings; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(BiomeColorMappings.class) +public class MixinBiomeColorMappings { + @ModifyConstant(method = "getColorForBiome", constant = @Constant(intValue = 0xFF), remap = false) + private static int getBitMask(int oldValue) { + return 0xFFFFFFFF; + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeHelper.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeHelper.java new file mode 100644 index 0000000..e3e6ab1 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinBiomeHelper.java @@ -0,0 +1,19 @@ +package org.dimdev.jeid.mixin.modsupport.biometweaker; + +import me.superckl.biometweaker.util.BiomeHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(BiomeHelper.class) +public class MixinBiomeHelper { + @ModifyConstant(method = "getNextFreeBiomeId", constant = @Constant(intValue = 0xFF), remap = false) + private static int getMaxBiomeId(int oldValue) { + return 0xFFFFFFFF; + } + + @ModifyConstant(method = "getNextFreeBiomeId", constant = @Constant(intValue = 0x100), remap = false) + private static int getLoopUpperLimit(int oldValue) { + return 0xEFFFFFFF; + } +} diff --git a/src/main/resources/mixins.jeid.modsupport.json b/src/main/resources/mixins.jeid.modsupport.json index 24429a5..07d9672 100644 --- a/src/main/resources/mixins.jeid.modsupport.json +++ b/src/main/resources/mixins.jeid.modsupport.json @@ -11,6 +11,8 @@ "advancedrocketry.MixinPacketBiomeIDChange", "biomesoplenty.MixinBOPCommand", "biomesoplenty.MixinModBiomes", + "biometweaker.MixinBiomeColorMappings", + "biometweaker.MixinBiomeHelper", "biometweaker.MixinCommandSetBiome", "bookshelf.MixinWorldUtils", "creepingnether.MixinCorruptorAbstract",