From 7b03a5c0d11bccdef97a1a828f2011040e8e181b Mon Sep 17 00:00:00 2001 From: Sergey Shatunov Date: Thu, 4 Feb 2016 22:55:51 +0700 Subject: [PATCH] Add out-of-box fast leaves decay --- patches/net/minecraft/block/BlockLeaves.java.patch | 14 ++++++++++++++ src/main/java/kcauldron/KCauldronConfig.java | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/patches/net/minecraft/block/BlockLeaves.java.patch b/patches/net/minecraft/block/BlockLeaves.java.patch index 9e9d924..7b6e553 100644 --- a/patches/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/net/minecraft/block/BlockLeaves.java.patch @@ -26,3 +26,17 @@ this.dropBlockAsItem(p_150126_1_, p_150126_2_, p_150126_3_, p_150126_4_, p_150126_1_.getBlockMetadata(p_150126_2_, p_150126_3_, p_150126_4_), 0); p_150126_1_.setBlockToAir(p_150126_2_, p_150126_3_, p_150126_4_); } +@@ -308,6 +320,13 @@ + world.setBlockMetadataWithNotify(x, y, z, i2 | 8, 4); + } + world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4); ++ // KCauldron start - fast leaves decay ++ if (net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayEnable.getValue()) { ++ int min = net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayMinTickTime.getValue(); ++ int max = net.minecraft.server.MinecraftServer.kcauldronConfig.commonFastLeavesDecayMaxTickTime.getValue(); ++ world.scheduleBlockUpdate(x, y, z, this, min + world.rand.nextInt(max - min)); ++ } ++ // KCauldron end + } + + @Override diff --git a/src/main/java/kcauldron/KCauldronConfig.java b/src/main/java/kcauldron/KCauldronConfig.java index c247736..05cb9af 100644 --- a/src/main/java/kcauldron/KCauldronConfig.java +++ b/src/main/java/kcauldron/KCauldronConfig.java @@ -5,6 +5,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import net.minecraft.server.MinecraftServer; import net.minecraftforge.cauldron.configuration.BoolSetting; import net.minecraftforge.cauldron.configuration.ConfigBase; +import net.minecraftforge.cauldron.configuration.IntSetting; import net.minecraftforge.cauldron.configuration.Setting; import net.minecraftforge.cauldron.configuration.StringSetting; @@ -29,6 +30,12 @@ public class KCauldronConfig extends ConfigBase { public BoolSetting commonAllowNetherPortal = new BoolSetting(this, "common.allowNetherPortalBesidesOverworld", false, "Allow nether portals in dimensions besides overworld"); + public BoolSetting commonFastLeavesDecayEnable = new BoolSetting(this, + "common.fastLeavesDecay.enable", false, "Enable fast decaying of leaves, not affects drop chanches /etc"); + public IntSetting commonFastLeavesDecayMinTickTime = new IntSetting(this, + "common.fastLeavesDecay.minTickTime", 5, "Minimal amount of tick between block updates"); + public IntSetting commonFastLeavesDecayMaxTickTime = new IntSetting(this, + "common.fastLeavesDecay.maxTickTime", 10, "Minimal amount of tick between block updates"); public BoolSetting experimentalTileEntityListRecreation = new BoolSetting(this, "experimental.tileEntityListRecreation", false, "EXPERIMENTAL! Recreate list of TE each tick."); @@ -45,6 +52,9 @@ public class KCauldronConfig extends ConfigBase { register(loggingMaterialInjection); register(loggingClientModList); register(commonAllowNetherPortal); + register(commonFastLeavesDecayEnable); + register(commonFastLeavesDecayMinTickTime); + register(commonFastLeavesDecayMaxTickTime); register(experimentalTileEntityListRecreation); load(); }