mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-28 03:19:22 +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 a5d391af2c6b733d653188f4aeeec2afffd96adf..be27ca377ab9317391b0e7af494f17d71333c10c 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 f19a1ea64d26723d738b007c5102fe44b963bfb6..199a41f7c16dca7b70951c52e9535cfcd5fdf224 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ChorusFlowerBlock.java
|
|
@@ -35,8 +35,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 3a1aa4e2405090ccebefb7f5944f36462929e221..ee7d8790cb9fcbcb2f444b569a14dd352e5c3749 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
|