Skip to content

Commit

Permalink
Prevent Massive World Destroying Sacred Rubber Tree Generation (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrParadox7 authored Nov 24, 2024
1 parent 641d70b commit faecb72
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,12 @@ public class FixesConfig {
@Config.DefaultBoolean(true)
public static boolean java12MineChemCompat;

// Minefactory Reloaded

@Config.Comment("Prevents Sacred Rubber Tree Generation")
@Config.DefaultBoolean(false)
public static boolean disableMassiveSacredTreeGeneration;

// Morpheus

@Config.Comment("Fix not properly waking players if not everyone is sleeping")
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ 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")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +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;

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

0 comments on commit faecb72

Please sign in to comment.