Skip to content

Commit 21a4154

Browse files
authored
Add leaves instant decay option (#1803)
1 parent 948343a commit 21a4154

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- a/net/minecraft/world/level/block/LeavesBlock.java
2+
+++ b/net/minecraft/world/level/block/LeavesBlock.java
3+
@@ -65,6 +_,12 @@
4+
5+
@Override
6+
protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) {
7+
+ // Purpur start - Instant leaves decay
8+
+ if (!level.purpurConfig.leavesInstantDecay) checkDecay(state, level, pos, random);
9+
+ }
10+
+
11+
+ private void checkDecay(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) {
12+
+ // Purpur end - Instant leaves decay
13+
if (this.decaying(state)) {
14+
// CraftBukkit start
15+
org.bukkit.event.block.LeavesDecayEvent event = new org.bukkit.event.block.LeavesDecayEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos));
16+
@@ -86,6 +_,7 @@
17+
@Override
18+
protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) {
19+
level.setBlock(pos, updateDistance(state, level, pos), Block.UPDATE_ALL);
20+
+ if (level.purpurConfig.leavesInstantDecay) checkDecay(state, level, pos, random); // Purpur - Instant leaves decay
21+
}
22+
23+
@Override

purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,4 +3899,9 @@ private void shearsCanDefuseTntSettings() {
38993899
shearsCanDefuseTntChance = (float) getDouble("gameplay-mechanics.item.shears.defuse-tnt-chance", 0.00D);
39003900
shearsCanDefuseTnt = shearsCanDefuseTntChance > 0.00F;
39013901
}
3902+
3903+
public boolean leavesInstantDecay = false;
3904+
private void leavesSettings() {
3905+
leavesInstantDecay = getBoolean("blocks.leaves.instant-decay", leavesInstantDecay);
3906+
}
39023907
}

0 commit comments

Comments
 (0)