From a7eb3fdfd8b69dc2f304099532768252c52ca3cc Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Tue, 10 Dec 2024 20:25:34 +1100 Subject: [PATCH] #1522: Call BlockFormEvent when an Eyeblossom opens or closes --- .../world/level/block/BlockFlowerPot.patch | 21 +++++++++++++++++++ .../world/level/block/EyeblossomBlock.patch | 15 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 nms-patches/net/minecraft/world/level/block/BlockFlowerPot.patch create mode 100644 nms-patches/net/minecraft/world/level/block/EyeblossomBlock.patch diff --git a/nms-patches/net/minecraft/world/level/block/BlockFlowerPot.patch b/nms-patches/net/minecraft/world/level/block/BlockFlowerPot.patch new file mode 100644 index 000000000..d0d5059eb --- /dev/null +++ b/nms-patches/net/minecraft/world/level/block/BlockFlowerPot.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/world/level/block/BlockFlowerPot.java ++++ b/net/minecraft/world/level/block/BlockFlowerPot.java +@@ -137,11 +137,14 @@ + boolean flag1 = CreakingHeartBlock.isNaturalNight(worldserver); + + if (flag != flag1) { +- worldserver.setBlock(blockposition, this.opposite(iblockdata), 3); +- EyeblossomBlock.a eyeblossomblock_a = EyeblossomBlock.a.fromBoolean(flag).transform(); ++ // CraftBukkit start - BlockFormEvent ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, this.opposite(iblockdata), 3)) { ++ EyeblossomBlock.a eyeblossomblock_a = EyeblossomBlock.a.fromBoolean(flag).transform(); + +- eyeblossomblock_a.spawnTransformParticle(worldserver, blockposition, randomsource); +- worldserver.playSound((EntityHuman) null, blockposition, eyeblossomblock_a.longSwitchSound(), SoundCategory.BLOCKS, 1.0F, 1.0F); ++ eyeblossomblock_a.spawnTransformParticle(worldserver, blockposition, randomsource); ++ worldserver.playSound((EntityHuman) null, blockposition, eyeblossomblock_a.longSwitchSound(), SoundCategory.BLOCKS, 1.0F, 1.0F); ++ } ++ // CraftBukkit end + } + } + diff --git a/nms-patches/net/minecraft/world/level/block/EyeblossomBlock.patch b/nms-patches/net/minecraft/world/level/block/EyeblossomBlock.patch new file mode 100644 index 000000000..8c4d639f1 --- /dev/null +++ b/nms-patches/net/minecraft/world/level/block/EyeblossomBlock.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/level/block/EyeblossomBlock.java ++++ b/net/minecraft/world/level/block/EyeblossomBlock.java +@@ -88,7 +88,11 @@ + } else { + EyeblossomBlock.a eyeblossomblock_a = this.type.transform(); + +- worldserver.setBlock(blockposition, eyeblossomblock_a.state(), 3); ++ // CraftBukkit start - BlockFormEvent ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, eyeblossomblock_a.state(), 3)) { ++ return false; ++ } ++ // CraftBukkit end + worldserver.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata)); + eyeblossomblock_a.spawnTransformParticle(worldserver, blockposition, randomsource); + BlockPosition.betweenClosed(blockposition.offset(-3, -2, -3), blockposition.offset(3, 2, 3)).forEach((blockposition1) -> {