Skip to content

Commit 439972c

Browse files
committed
Readd BlockGrowEvent for cactus flower
1 parent 15af455 commit 439972c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

paper-server/patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/net/minecraft/world/level/block/CactusBlock.java
22
+++ b/net/minecraft/world/level/block/CactusBlock.java
3-
@@ -58,18 +_,22 @@
3+
@@ -58,18 +_,18 @@
44
int age = state.getValue(AGE);
55

66
while (level.getBlockState(pos.below(height)).is(this)) {
@@ -14,16 +14,13 @@
1414
- double chanceToGrowFlower = height >= 3 ? 0.25 : 0.1;
1515
+ double chanceToGrowFlower = height >= level.paperConfig().maxGrowthHeight.cactus ? 0.25 : 0.1; // Paper - Configurable cactus/bamboo/reed growth height
1616
if (random.nextDouble() <= chanceToGrowFlower) {
17-
level.setBlockAndUpdate(above, Blocks.CACTUS_FLOWER.defaultBlockState());
17+
- level.setBlockAndUpdate(above, Blocks.CACTUS_FLOWER.defaultBlockState());
18+
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, above, Blocks.CACTUS_FLOWER.defaultBlockState(), Block.UPDATE_ALL); // Paper - block grow event
1819
}
1920
- } else if (age == 15 && height < 3) {
2021
- level.setBlockAndUpdate(above, this.defaultBlockState());
2122
+ } else if (age == 15 && height < level.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth height
22-
+ // Paper start
23-
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, above, this.defaultBlockState(), Block.UPDATE_ALL)) {
24-
+ return;
25-
+ }
26-
+ // Paper end
23+
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, above, this.defaultBlockState(), Block.UPDATE_ALL)) return; // Paper - block grow event
2724
BlockState aboveBlock = state.setValue(AGE, 0);
2825
level.setBlock(pos, aboveBlock, Block.UPDATE_NONE);
2926
level.neighborChanged(aboveBlock, above, this, null, false);

0 commit comments

Comments
 (0)