0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/BlockDragonEgg.patch
2024-04-24 01:15:00 +10:00

31 lines
1.7 KiB
Diff

--- a/net/minecraft/world/level/block/BlockDragonEgg.java
+++ b/net/minecraft/world/level/block/BlockDragonEgg.java
@@ -16,6 +16,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
+
public class BlockDragonEgg extends BlockFalling {
public static final MapCodec<BlockDragonEgg> CODEC = simpleCodec(BlockDragonEgg::new);
@@ -53,6 +55,18 @@
BlockPosition blockposition1 = blockposition.offset(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
if (world.getBlockState(blockposition1).isAir() && worldborder.isWithinBounds(blockposition1)) {
+ // CraftBukkit start
+ org.bukkit.block.Block from = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block to = world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
+ BlockFromToEvent event = new BlockFromToEvent(from, to);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+
+ blockposition1 = new BlockPosition(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ());
+ // CraftBukkit end
if (world.isClientSide) {
for (int j = 0; j < 128; ++j) {
double d0 = world.random.nextDouble();