9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-04 15:31:43 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0015-Disable-leaf-decay.patch
NONPLAYT d9c4e8a199 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@efc76215 Add missing copper blocks to waxables and weatherables options (#1712)
PurpurMC/Purpur@3ca0d663 Updated Upstream (Paper)
PurpurMC/Purpur@917675d0 Updated Upstream (Paper)
PurpurMC/Purpur@ffe2f809 Add option to disable Warden Sonic Boom (#1713)
2025-10-28 03:51:29 +03:00

43 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 6 Jul 2025 03:03:04 +0300
Subject: [PATCH] Disable leaf decay
diff --git a/net/minecraft/world/level/block/LeavesBlock.java b/net/minecraft/world/level/block/LeavesBlock.java
index 66be73fe9ad14646057fa51b7c537a86c1e84ab9..4371fd03e4b5bd3a18024e0a9ee0e75cd77137e9 100644
--- a/net/minecraft/world/level/block/LeavesBlock.java
+++ b/net/minecraft/world/level/block/LeavesBlock.java
@@ -70,12 +70,29 @@ public abstract class LeavesBlock extends Block implements SimpleWaterloggedBloc
}
protected boolean decaying(BlockState state) {
- return !state.getValue(PERSISTENT) && state.getValue(DISTANCE) == 7;
+ return !org.bxteam.divinemc.config.DivineConfig.FixesCategory.disableLeafDecay && !state.getValue(PERSISTENT) && state.getValue(DISTANCE) == 7; // DivineMC - Disable leaf decay
}
@Override
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
- level.setBlock(pos, updateDistance(state, level, pos), 3);
+ // DivineMC start - Disable leaf decay
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.disableLeafDecay) return; // DivineMC - Disable leaf decay
+ int newValue = 7;
+ int oldValue = state.getValue(DISTANCE);
+ BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();
+
+ for (Direction direction : Direction.values()) {
+ mutable.setWithOffset(pos, direction);
+ newValue = Math.min(newValue, getDistanceAt(level.getBlockState(mutable)) + 1);
+ if (newValue == 1) {
+ break;
+ }
+ }
+
+ if (newValue != oldValue) {
+ level.setBlock(pos, state.setValue(DISTANCE, newValue), 3);
+ }
+ // DivineMC end - Disable leaf decay
}
@Override