13
0
geforkt von Mirrors/Paper
Paper/nms-patches/EntityArmorStand.patch
2015-02-15 12:48:56 +11:00

63 Zeilen
2.6 KiB
Diff

--- ../work/decompile-8eb82bde/net/minecraft/server/EntityArmorStand.java 2015-02-15 12:48:44.653310353 +1100
+++ src/main/java/net/minecraft/server/EntityArmorStand.java 2015-02-15 12:48:44.653310353 +1100
@@ -2,6 +2,15 @@
import java.util.List;
+// CraftBukkit start
+import org.bukkit.inventory.EquipmentSlot;
+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 {
private static final Vector3f a = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -323,6 +332,22 @@
ItemStack itemstack1 = entityhuman.inventory.getItem(j);
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack1);
+
+ Player player = (Player) entityhuman.getBukkitEntity();
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
+
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(i);
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+
+ if (armorStandManipulateEvent.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
if (entityhuman.abilities.canInstantlyBuild && (itemstack == null || itemstack.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack1 != null) {
itemstack2 = itemstack1.cloneItemStack();
itemstack2.count = 1;
@@ -343,6 +368,11 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
if (!this.world.isStatic && !this.h) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
this.die();
@@ -542,6 +572,8 @@
}
this.datawatcher.watch(10, Byte.valueOf(b0));
+
+ this.T = flag; // CraftBukkit. // PAIL: Rename (noclip)
}
public boolean hasGravity() {