Paper/nms-patches/EntityArmorStand.patch

53 Zeilen
2.4 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityArmorStand.java
+++ b/net/minecraft/server/EntityArmorStand.java
2016-05-10 13:47:39 +02:00
@@ -5,6 +5,15 @@
2015-02-15 02:24:14 +01:00
import java.util.List;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
2015-02-15 02:24:14 +01:00
+// CraftBukkit start
2015-02-15 02:48:56 +01:00
+import org.bukkit.inventory.EquipmentSlot;
2015-02-15 02:24:14 +01:00
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
+// CraftBukkit end
+
public class EntityArmorStand extends EntityLiving {
2016-06-09 03:43:49 +02:00
private static final Vector3f br = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -373,6 +382,21 @@
if (itemstack1 == null || (this.bB & 1 << enumitemslot.c() + 8) == 0) {
if (itemstack1 != null || (this.bB & 1 << enumitemslot.c() + 16) == 0) {
2015-02-15 02:24:14 +01:00
ItemStack itemstack2;
+ // CraftBukkit start
2016-02-29 22:32:46 +01:00
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);
2015-02-15 02:24:14 +01:00
+
+ Player player = (Player) entityhuman.getBukkitEntity();
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
+
2016-02-29 22:32:46 +01:00
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
2015-02-15 02:24:14 +01:00
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+
+ if (armorStandManipulateEvent.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
if (entityhuman.abilities.canInstantlyBuild && (itemstack1 == null || itemstack1.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack != null) {
itemstack2 = itemstack.cloneItemStack();
2016-06-09 03:43:49 +02:00
@@ -394,6 +418,11 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
if (!this.world.isClientSide && !this.dead) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
this.die();