mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
86 lines
4.4 KiB
Diff
86 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Sun, 30 Jul 2023 12:20:16 +0800
|
|
Subject: [PATCH] Zero tick plants
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/block/BambooStalkBlock.java b/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
index a6249f5852c4ac2432bb60cb4f7a2e0a03abd7dd..29f9866e693dbbf9487cdc15ca8d2f5576cde00c 100644
|
|
--- a/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
+++ b/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
@@ -109,6 +109,10 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
|
|
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(level, pos)) {
|
|
level.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.zeroTickPlants) {
|
|
+ this.randomTick(state, level, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/level/block/CactusBlock.java b/net/minecraft/world/level/block/CactusBlock.java
|
|
index d4fbf130e23a959be8268085067b3bea1541be9a..a8cb3264ebc3b9728ce1a1af449f7ccb4d3c9973 100644
|
|
--- a/net/minecraft/world/level/block/CactusBlock.java
|
|
+++ b/net/minecraft/world/level/block/CactusBlock.java
|
|
@@ -47,6 +47,10 @@ public class CactusBlock extends Block {
|
|
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(level, pos)) {
|
|
level.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.zeroTickPlants) {
|
|
+ this.randomTick(state, level, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/level/block/ChorusFlowerBlock.java b/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
index 32ba79c568ef9e75639f03cd7cc34be569638742..46af89f48716a661c4ca31334299d874d29a0b36 100644
|
|
--- a/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
+++ b/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
@@ -49,6 +49,9 @@ public class ChorusFlowerBlock extends Block {
|
|
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(level, pos)) {
|
|
level.destroyBlock(pos, true);
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.zeroTickPlants) {
|
|
+ this.randomTick(state, level, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
index fe11f3ec82ebdbdf3d024d7273fb16b6823b1ece..577ba4b329e6d1e224d6ea57b224ad92e1993d65 100644
|
|
--- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
+++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
@@ -155,4 +155,15 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
|
protected GrowingPlantHeadBlock getHeadBlock() {
|
|
return this;
|
|
}
|
|
+
|
|
+ // Leaves start - zero tick plants
|
|
+ @Override
|
|
+ public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
+ if (!state.canSurvive(world, pos)) {
|
|
+ world.destroyBlock(pos, true);
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
diff --git a/net/minecraft/world/level/block/SugarCaneBlock.java b/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
index a8de37e173e244d7a16c19ac8805e0e4327c837a..c6803d4869459b778d6a331950889ae1814422ce 100644
|
|
--- a/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
+++ b/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
@@ -43,6 +43,10 @@ public class SugarCaneBlock extends Block {
|
|
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(level, pos)) {
|
|
level.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.zeroTickPlants) {
|
|
+ this.randomTick(state, level, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
}
|
|
|