mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-30 20:39:15 +00:00
95 lines
4.7 KiB
Diff
95 lines
4.7 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/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
index 05a508cb457b67078ccb08bd2228a59e73701cf3..a1d340eb20fab567eee26591dffee2c57cfafd05 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
|
|
@@ -115,8 +115,11 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
|
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (top.leavesmc.leaves.LeavesConfig.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
-
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
index 0003fb51ae3a6575575e10b4c86719f3061e2577..12e251428260c6e05e9a48c71493aaf2bd2b486b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
@@ -39,8 +39,11 @@ public class CactusBlock extends Block {
|
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (top.leavesmc.leaves.LeavesConfig.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
-
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java b/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
index e9beebedf1d60e06e16c442b64d28d022a3e3164..cda6d18e4bdaec7d581169b3b8237bb00c1c2962 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
@@ -39,8 +39,11 @@ public class ChorusFlowerBlock extends Block {
|
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (top.leavesmc.leaves.LeavesConfig.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
-
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
index b325fdec8eb99ce57152a5c0fefa5059685276e4..5897fdb2b9d4eaa07d539d92e74a71f8cee01d7b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
@@ -138,4 +138,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 (top.leavesmc.leaves.LeavesConfig.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
index c3f500580d257e1397f2eb7c47b063a6fe6bb405..34de88e9677deb7b81b314d48c4880cce451d6a6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
|
@@ -39,8 +39,11 @@ public class SugarCaneBlock extends Block {
|
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.destroyBlock(pos, true);
|
|
+ // Leaves start - zero tick plants
|
|
+ } else if (top.leavesmc.leaves.LeavesConfig.zeroTickPlants) {
|
|
+ this.randomTick(state, world, pos, random);
|
|
+ // Leaves end - zero tick plants
|
|
}
|
|
-
|
|
}
|
|
|
|
@Override
|