mirror of
https://github.com/BX-Team/DivineMC.git
synced 2026-01-04 15:31:43 +00:00
43 lines
1.9 KiB
Diff
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 d5b114dca7b28d910f03ae3468e891d5d9863897..dbe3702bab05e38e21cd2e5e0fad793fee36c04a 100644
|
|
--- a/net/minecraft/world/level/block/LeavesBlock.java
|
|
+++ b/net/minecraft/world/level/block/LeavesBlock.java
|
|
@@ -80,12 +80,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), Block.UPDATE_ALL);
|
|
+ // 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), Block.UPDATE_ALL);
|
|
+ }
|
|
+ // DivineMC end - Disable leaf decay
|
|
}
|
|
|
|
@Override
|