From cf0ade3ba3f010c503dfe107eb139b11e0b2e389 Mon Sep 17 00:00:00 2001 From: JLitewski Date: Sat, 22 Jul 2023 23:54:02 -0400 Subject: [PATCH] Rewrote Amethyst logic to throw both BlockGrowEvent and BlockSpreadEvent (#9217) With this patch, it is now possible to further control what plugins can do with Amethyst Blocks. You can prevent Budding Amethyst blocks from creating shards with the BlockSreadEvent, and when shards grow, it can be prevented with BlockGrowEvent --- ...st-throw-both-Spread-and-Grow-Events.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch diff --git a/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch new file mode 100644 index 0000000000..3e0edad602 --- /dev/null +++ b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jacob Litewski +Date: Tue, 13 Jun 2023 19:16:39 -0400 +Subject: [PATCH] Make Amethyst throw both Spread and Grow Events + + +diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java +@@ -0,0 +0,0 @@ public class BuddingAmethystBlock extends AmethystBlock { + if (block != null) { + BlockState iblockdata2 = (BlockState) ((BlockState) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER); + ++ // Paper Start - Have Amethyst throw both spread and grow events ++ if (block == Blocks.SMALL_AMETHYST_BUD) { + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit ++ } else { ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition1, iblockdata2); ++ } ++ // Paper end + } + + }