3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00
Paper/nms-patches/EntityEnderman.patch

31 Zeilen
1.6 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityEnderman.java
+++ b/net/minecraft/server/EntityEnderman.java
2016-02-29 22:32:46 +01:00
@@ -306,8 +306,12 @@
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
2016-02-29 22:32:46 +01:00
if (EntityEnderman.c.contains(block) && flag) {
2015-02-26 23:41:06 +01:00
- this.enderman.setCarried(iblockdata);
2016-02-29 22:32:46 +01:00
- world.setAir(blockposition);
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start - Pickup event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, this.enderman.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), org.bukkit.Material.AIR).isCancelled()) {
+ this.enderman.setCarried(iblockdata);
2016-02-29 22:32:46 +01:00
+ world.setAir(blockposition);
2015-02-26 23:41:06 +01:00
+ }
+ // CraftBukkit end
}
}
2016-02-29 22:32:46 +01:00
@@ -337,8 +341,12 @@
IBlockData iblockdata2 = this.a.getCarried();
2015-02-26 23:41:06 +01:00
2016-02-29 22:32:46 +01:00
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start - Place event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) {
2016-02-29 22:32:46 +01:00
world.setTypeAndData(blockposition, iblockdata2, 3);
this.a.setCarried((IBlockData) null);
2015-02-26 23:41:06 +01:00
+ }
+ // CraftBukkit end
}
}