readd cactus config

This commit is contained in:
Lulu13022002
2024-12-15 16:40:37 +01:00
parent 6d7c3255f6
commit 46eccd8c7d
3 changed files with 27 additions and 17 deletions

View File

@@ -1,5 +1,26 @@
--- a/net/minecraft/world/level/block/CactusBlock.java
+++ b/net/minecraft/world/level/block/CactusBlock.java
@@ -56,14 +_,17 @@
i++;
}
- if (i < 3) {
+ if (i < level.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth height
int ageValue = state.getValue(AGE);
- if (ageValue == 15) {
+
+ int modifier = level.spigotConfig.cactusModifier; // Spigot - SPIGOT-7159: Better modifier resolution
+ if (ageValue >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, blockPos, this.defaultBlockState()); // CraftBukkit
level.setBlockAndUpdate(blockPos, this.defaultBlockState());
BlockState blockState = state.setValue(AGE, Integer.valueOf(0));
level.setBlock(pos, blockState, 4);
level.neighborChanged(blockState, blockPos, this, null, false);
- } else {
+ } else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution
level.setBlock(pos, state.setValue(AGE, Integer.valueOf(ageValue + 1)), 4);
}
}
@@ -113,7 +_,8 @@
@Override