From fbf67bfe026e4957ce0518299a096be07f73e16c Mon Sep 17 00:00:00 2001 From: DrParadox7 Date: Sat, 23 Nov 2024 20:48:38 +0100 Subject: [PATCH 1/3] Prevent Massive World Destroying Sacred Rubber Tree Generation Downscaling it to a reasonable Mega sized one instead. --- .../hodgepodge/config/FixesConfig.java | 7 +++++ .../mitchej123/hodgepodge/mixins/Mixins.java | 5 ++++ .../MixinBlockRubberSapling.java | 26 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java diff --git a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java index 3a953e03..876c1976 100644 --- a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java @@ -498,6 +498,13 @@ public class FixesConfig { @Config.DefaultBoolean(true) public static boolean java12MineChemCompat; + // Minefactory Reloaded + + @Config.Comment("Prevents Sacred Rubber Tree Generation") + @Config.DefaultBoolean(true) + public static boolean disableMassiveSacredTreeGeneration; + + // Morpheus @Config.Comment("Fix not properly waking players if not everyone is sleeping") diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java index f9931504..fef61310 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java @@ -608,6 +608,11 @@ public enum Mixins { .addMixinClasses("cofhcore.MixinOreDictionaryArbiter").setPhase(Phase.EARLY).setSide(Side.BOTH) .addTargetedMod(TargetedMod.COFH_CORE).setApplyIf(() -> FixesConfig.fixCofhOreDictNPE)), + // Minefactory Reloaded + DISARM_SACRED_TREE(new Builder("Prevents Sacred Rubber Tree Generation") + .addMixinClasses("minefactoryreloaded..MixinBlockRubberSapling").setPhase(Phase.LATE).setSide(Side.BOTH) + .addTargetedMod(TargetedMod.MINEFACTORY_RELOADED).setApplyIf(() -> FixesConfig.disableMassiveSacredTreeGeneration)), + // Immersive engineering JAVA12_IMMERSIVE_ENGINERRING(new Builder("Immersive Engineering Java-12 safe potion array resizing") .setPhase(Phase.LATE).setSide(Side.BOTH).addMixinClasses("immersiveengineering.MixinIEPotions") diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java b/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java new file mode 100644 index 00000000..95a77682 --- /dev/null +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java @@ -0,0 +1,26 @@ +package com.mitchej123.hodgepodge.mixins.late.minefactoryreloaded; + +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import powercrystals.minefactoryreloaded.block.BlockRubberSapling; +import powercrystals.minefactoryreloaded.world.MineFactoryReloadedWorldGen; +import powercrystals.minefactoryreloaded.world.WorldGenMassiveTree; + +import java.util.Random; + +@Mixin(BlockRubberSapling.class) +public class MixinBlockRubberSapling { + + /** + * @author DrParadox7 + * @reason Swap Massive world-breaking tree to Mega, a still reasonably large but safe tree, should it still be obtained by chance. + */ + @Redirect( + method = "func_149878_d", + at = @At(value = "INVOKE", target = "Lpowercrystals/minefactoryreloaded/world/WorldGenMassiveTree;generate(Lnet/minecraft/world/World;Ljava/util/Random;III)Z")) + private boolean hodgepodge$generateMassiveRubberTree(WorldGenMassiveTree instance, World world, Random random, int x, int y, int z) { + return MineFactoryReloadedWorldGen.generateMegaRubberTree(world, random, x, y, z, true); + } +} From 95781d930ca10b8e1585a3d1c96ede12a90b91d1 Mon Sep 17 00:00:00 2001 From: DrParadox7 Date: Sat, 23 Nov 2024 20:59:12 +0100 Subject: [PATCH 2/3] SpotlessApply --- .../hodgepodge/config/FixesConfig.java | 1 - .../com/mitchej123/hodgepodge/mixins/Mixins.java | 3 ++- .../MixinBlockRubberSapling.java | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java index e66ecf9b..80db16b1 100644 --- a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java @@ -529,7 +529,6 @@ public class FixesConfig { @Config.DefaultBoolean(true) public static boolean disableMassiveSacredTreeGeneration; - // Morpheus @Config.Comment("Fix not properly waking players if not everyone is sleeping") diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java index 91a3575e..3355f7ad 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java @@ -633,7 +633,8 @@ public enum Mixins { // Minefactory Reloaded DISARM_SACRED_TREE(new Builder("Prevents Sacred Rubber Tree Generation") .addMixinClasses("minefactoryreloaded..MixinBlockRubberSapling").setPhase(Phase.LATE).setSide(Side.BOTH) - .addTargetedMod(TargetedMod.MINEFACTORY_RELOADED).setApplyIf(() -> FixesConfig.disableMassiveSacredTreeGeneration)), + .addTargetedMod(TargetedMod.MINEFACTORY_RELOADED) + .setApplyIf(() -> FixesConfig.disableMassiveSacredTreeGeneration)), // Immersive engineering JAVA12_IMMERSIVE_ENGINERRING(new Builder("Immersive Engineering Java-12 safe potion array resizing") diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java b/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java index 95a77682..827493d7 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinBlockRubberSapling.java @@ -1,26 +1,32 @@ package com.mitchej123.hodgepodge.mixins.late.minefactoryreloaded; +import java.util.Random; + import net.minecraft.world.World; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; + import powercrystals.minefactoryreloaded.block.BlockRubberSapling; import powercrystals.minefactoryreloaded.world.MineFactoryReloadedWorldGen; import powercrystals.minefactoryreloaded.world.WorldGenMassiveTree; -import java.util.Random; - @Mixin(BlockRubberSapling.class) public class MixinBlockRubberSapling { /** * @author DrParadox7 - * @reason Swap Massive world-breaking tree to Mega, a still reasonably large but safe tree, should it still be obtained by chance. + * @reason Swap Massive world-breaking tree to Mega, a still reasonably large but safe tree, should it still be + * obtained by chance. */ @Redirect( method = "func_149878_d", - at = @At(value = "INVOKE", target = "Lpowercrystals/minefactoryreloaded/world/WorldGenMassiveTree;generate(Lnet/minecraft/world/World;Ljava/util/Random;III)Z")) - private boolean hodgepodge$generateMassiveRubberTree(WorldGenMassiveTree instance, World world, Random random, int x, int y, int z) { + at = @At( + value = "INVOKE", + target = "Lpowercrystals/minefactoryreloaded/world/WorldGenMassiveTree;generate(Lnet/minecraft/world/World;Ljava/util/Random;III)Z")) + private boolean hodgepodge$generateMassiveRubberTree(WorldGenMassiveTree instance, World world, Random random, + int x, int y, int z) { return MineFactoryReloadedWorldGen.generateMegaRubberTree(world, random, x, y, z, true); } } From 8f1c84c820f97c31a7612bcecd33504040d2052f Mon Sep 17 00:00:00 2001 From: DrParadox7 Date: Sun, 24 Nov 2024 18:54:01 +0100 Subject: [PATCH 3/3] Sacred Rubber Tree Config Defaults to False +fixes double .. breaking the mixin class reference --- src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java | 2 +- src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java index 80db16b1..8fb422b8 100644 --- a/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/config/FixesConfig.java @@ -526,7 +526,7 @@ public class FixesConfig { // Minefactory Reloaded @Config.Comment("Prevents Sacred Rubber Tree Generation") - @Config.DefaultBoolean(true) + @Config.DefaultBoolean(false) public static boolean disableMassiveSacredTreeGeneration; // Morpheus diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java index 3355f7ad..6cb56467 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java @@ -632,7 +632,7 @@ public enum Mixins { // Minefactory Reloaded DISARM_SACRED_TREE(new Builder("Prevents Sacred Rubber Tree Generation") - .addMixinClasses("minefactoryreloaded..MixinBlockRubberSapling").setPhase(Phase.LATE).setSide(Side.BOTH) + .addMixinClasses("minefactoryreloaded.MixinBlockRubberSapling").setPhase(Phase.LATE).setSide(Side.BOTH) .addTargetedMod(TargetedMod.MINEFACTORY_RELOADED) .setApplyIf(() -> FixesConfig.disableMassiveSacredTreeGeneration)),