Skip to content

Commit

Permalink
Rewrote Amethyst logic to throw both BlockGrowEvent and BlockSpreadEv…
Browse files Browse the repository at this point in the history
…ent (#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
  • Loading branch information
jlitewski authored Jul 23, 2023
1 parent 2c54b39 commit e19177a
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jacob Litewski <jacob.litewski@gmail.com>
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 4dae2a98070affd84bc4523a927dc9cbfe7379c6..2548244c089dff583c8c424dcaa5504caedf3f10 100644
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -38,7 +38,13 @@ 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
}

}

0 comments on commit e19177a

Please sign in to comment.