mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-30 20:39:15 +00:00
Zero tick plants (#29)
This commit is contained in:
@@ -128,10 +128,10 @@ index 35d2da9d91dcdd89de7c0f4af028fd182376ea8d..d73482fb1e71fe2951e96ae0593de268
|
||||
.withRequiredArg()
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0424eba1d6e01c13497a15c858c4e90ae1a85a5
|
||||
index 0000000000000000000000000000000000000000..74c28538d3a998b208808649e3841e3838777e80
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -0,0 +1,951 @@
|
||||
@@ -0,0 +1,956 @@
|
||||
+package top.leavesmc.leaves;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
@@ -908,6 +908,11 @@ index 0000000000000000000000000000000000000000..f0424eba1d6e01c13497a15c858c4e90
|
||||
+ bowInfinityFix = getBoolean("settings.modify.bow-infinity-fix", bowInfinityFix);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean zeroTickPlants = false;
|
||||
+ private static void zeroTickPlants() {
|
||||
+ zeroTickPlants = getBoolean("settings.modify.zero-tick-plants", zeroTickPlants);
|
||||
+ }
|
||||
+
|
||||
+ public static final class WorldConfig {
|
||||
+
|
||||
+ public final String worldName;
|
||||
|
||||
94
patches/server/0114-Zero-tick-plants.patch
Normal file
94
patches/server/0114-Zero-tick-plants.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
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
|
||||
Reference in New Issue
Block a user