Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Massive World Destroying Sacred Rubber Tree Generation #442

Merged
merged 4 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}