Skip to content

Commit 9c01f0c

Browse files
committed
fix wrong event call for cactus growth
1 parent 960ad6e commit 9c01f0c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99
return;
1010
}
1111
}
12-
@@ -66,17 +_,20 @@
12+
@@ -66,17 +_,21 @@
1313
if (ageValue == 8 && this.canSurvive(this.defaultBlockState(), level, pos.above())) {
1414
double d = i >= 3 ? 0.25 : 0.1;
1515
if (random.nextDouble() <= d) {
1616
- level.setBlockAndUpdate(blockPos, Blocks.CACTUS_FLOWER.defaultBlockState());
17-
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, Blocks.CACTUS_FLOWER.defaultBlockState(), 3);
18-
}
17+
- }
1918
- } else if (ageValue == 15 && i < 3) {
2019
- level.setBlockAndUpdate(blockPos, this.defaultBlockState());
20+
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, blockPos, Blocks.CACTUS_FLOWER.defaultBlockState(), 3);
21+
+ }
2122
+ } else if (ageValue == 15 && i < level.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth height
22-
BlockState blockState = state.setValue(AGE, 0);
23-
- level.setBlock(pos, blockState, 260);
2423
+ // Paper start
25-
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, blockState, 260)) {
24+
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, blockPos, this.defaultBlockState(), 3)) {
2625
+ return;
2726
+ }
2827
+ // Paper end
28+
BlockState blockState = state.setValue(AGE, 0);
29+
level.setBlock(pos, blockState, 260);
2930
level.neighborChanged(blockState, blockPos, this, null, false);
3031
}
3132

0 commit comments

Comments
 (0)