3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/nms-patches/BlockDragonEgg.patch

30 Zeilen
1.5 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockDragonEgg.java
+++ b/net/minecraft/server/BlockDragonEgg.java
2018-07-15 02:00:00 +02:00
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
+
2018-07-15 02:00:00 +02:00
public class BlockDragonEgg extends BlockFalling {
2018-07-15 02:00:00 +02:00
protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
2019-04-23 04:00:00 +02:00
@@ -29,6 +31,18 @@
BlockPosition blockposition1 = blockposition.b(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
2018-07-15 02:00:00 +02:00
if (world.getType(blockposition1).isAir()) {
+ // 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);
+
2018-07-15 02:00:00 +02:00
+ if (event.isCancelled()) {
+ return;
+ }
+
2018-07-15 02:00:00 +02:00
+ 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();