From 655ca7278c3197edc3c38d82958268e4191f4f07 Mon Sep 17 00:00:00 2001 From: kacimiamine Date: Mon, 13 Jul 2026 23:14:56 +0100 Subject: [PATCH 1/3] Add leaves instant decay option --- .../minecraft/world/level/block/LeavesBlock.java.patch | 10 ++++++++++ .../java/org/purpurmc/purpur/PurpurWorldConfig.java | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch new file mode 100644 index 000000000..9dd98d66e --- /dev/null +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/LeavesBlock.java ++++ b/net/minecraft/world/level/block/LeavesBlock.java +@@ -86,6 +_,7 @@ + @Override + protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + level.setBlock(pos, updateDistance(state, level, pos), Block.UPDATE_ALL); ++ if (level.purpurConfig.leavesInstantDecay) this.randomTick(state, level, pos, random); // Purpur - Instant leaves decay + } + + @Override diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index 1254649c4..922e0efbd 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -3899,4 +3899,9 @@ private void shearsCanDefuseTntSettings() { shearsCanDefuseTntChance = (float) getDouble("gameplay-mechanics.item.shears.defuse-tnt-chance", 0.00D); shearsCanDefuseTnt = shearsCanDefuseTntChance > 0.00F; } + + public boolean leavesInstantDecay = false; + private void leavesSettings() { + leavesInstantDecay = getBoolean("blocks.leaves.instant-decay", leavesInstantDecay); + } } From 6511258027e2d9ee02607fa8d15b9de5bf01950b Mon Sep 17 00:00:00 2001 From: kacimiamine Date: Tue, 14 Jul 2026 00:20:18 +0100 Subject: [PATCH 2/3] Add helper method This is better so that we ared not firing randomTick twice as this may cause issues with plugins that listen to the event --- .../world/level/block/LeavesBlock.java.patch | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch index 9dd98d66e..6075f9d69 100644 --- a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -1,10 +1,23 @@ --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java +@@ -65,6 +_,12 @@ + + @Override + protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ // Purpur start - Instant leaves decay ++ if (!level.purpurConfig.leavesInstantDecay) checkDecay(state, level, pos, random); ++ } ++ ++ protected void checkDecay(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ // Purpur end - Instant leaves decay + if (this.decaying(state)) { + // CraftBukkit start + org.bukkit.event.block.LeavesDecayEvent event = new org.bukkit.event.block.LeavesDecayEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)); @@ -86,6 +_,7 @@ @Override protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { level.setBlock(pos, updateDistance(state, level, pos), Block.UPDATE_ALL); -+ if (level.purpurConfig.leavesInstantDecay) this.randomTick(state, level, pos, random); // Purpur - Instant leaves decay ++ if (level.purpurConfig.leavesInstantDecay) checkDecay(state, level, pos, random); // Purpur - Instant leaves decay } @Override From df25f9197b4c162118a84f3af4dc6c4e43f6f3a1 Mon Sep 17 00:00:00 2001 From: kacimiamine Date: Tue, 14 Jul 2026 00:24:14 +0100 Subject: [PATCH 3/3] Use private instead of protected --- .../net/minecraft/world/level/block/LeavesBlock.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch index 6075f9d69..5f9bf6eea 100644 --- a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -8,7 +8,7 @@ + if (!level.purpurConfig.leavesInstantDecay) checkDecay(state, level, pos, random); + } + -+ protected void checkDecay(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { ++ private void checkDecay(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { + // Purpur end - Instant leaves decay if (this.decaying(state)) { // CraftBukkit start