Added thickHugeFungusGrowthFix rule (#1458)

This commit is contained in:
Ghoulboy authored and GitHub committed 2023-01-20 18:07:44 +01:00
1 parent 58a68739c5
commit bc5ece085c
3 files changed
+35

No files matched your search

+10
View File
@@ -1051,4 +1051,14 @@ public class CarpetSettings
)
public static int sculkSensorRange = 8;
public enum FungusFixMode {
FALSE, VANILLA, ALL;
}
@Rule(
desc = "Allows to grow nether trees with 3x3 base with bonemeal",
extra = {"Setting to 'all' will make all nether fungi grow into 3x3 trees", "Setting to 'vanilla' will make 6% of all nether fungi grow into 3x3 trees", "(this being consistent with worldgen)", "Fixes [MC-215169](https://bugs.mojang.com/browse/MC-215169)."},
category = {SURVIVAL, BUGFIX}
)
public static FungusFixMode thickHugeFungusGrowthFix = FungusFixMode.FALSE;
}
@@ -0,0 +1,24 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.levelgen.feature.HugeFungusConfiguration;
import net.minecraft.world.level.levelgen.feature.HugeFungusFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import static carpet.CarpetSettings.FungusFixMode.*;
@Mixin(HugeFungusFeature.class)
public class HugeFungusFeatureMixin {
@ModifyArgs(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/HugeFungusFeature;placeStem(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/feature/HugeFungusConfiguration;Lnet/minecraft/core/BlockPos;IZ)V"))
private void mixin(Args args) {
boolean natural = !((HugeFungusConfiguration) args.get(2)).planted;
args.set(5, natural && ((boolean) args.get(5)) ||
!natural && (CarpetSettings.thickHugeFungusGrowthFix.equals(ALL) ||
CarpetSettings.thickHugeFungusGrowthFix.equals(VANILLA) && ((RandomSource) args.get(1)).nextFloat() < 0.06F)
);
}
}
+1
View File
@@ -26,6 +26,7 @@
"FlowingFluid_liquidDamageDisabledMixin",
"ServerStatus_motdMixin",
"MinecraftServer_pingPlayerSampleLimit",
"HugeFungusFeatureMixin",
"MinecraftServer_coreMixin",