From da1947b2ad990aeb564b4ceb35ed4019a75daef1 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 15 Dec 2024 16:48:03 +0100 Subject: [PATCH] readd chorus flower events --- .../level/block/ChorusFlowerBlock.java.patch | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch index 7909effb3a..907be03335 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch @@ -11,7 +11,7 @@ } else if (ageValue < 4) { int i = random.nextInt(4); if (flag1) { -@@ -112,8 +_,10 @@ +@@ -112,18 +_,28 @@ if (level.isEmptyBlock(blockPos1) && level.isEmptyBlock(blockPos1.below()) && allNeighborsEmpty(level, blockPos1, randomDirection.getOpposite())) { @@ -22,3 +22,33 @@ } } + if (flag2) { + level.setBlock(pos, ChorusPlantBlock.getStateWithConnections(level, pos, this.plant.defaultBlockState()), 2); + } else { ++ // CraftBukkit start - add event ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, this.defaultBlockState().setValue(ChorusFlowerBlock.AGE, Integer.valueOf(5)), 2)) { + this.placeDeadFlower(level, pos); ++ } ++ // CraftBukkit end + } + } else { ++ // CraftBukkit start - add event ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, this.defaultBlockState().setValue(ChorusFlowerBlock.AGE, Integer.valueOf(5)), 2)) { + this.placeDeadFlower(level, pos); ++ } ++ // CraftBukkit end + } + } + } +@@ -261,6 +_,11 @@ + protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { + BlockPos blockPos = hit.getBlockPos(); + if (level instanceof ServerLevel serverLevel && projectile.mayInteract(serverLevel, blockPos) && projectile.mayBreak(serverLevel)) { ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockPos, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state ++ return; ++ } ++ // CraftBukkit end + level.destroyBlock(blockPos, true, projectile); + } + }