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 {
|
|
|
|
|
2017-05-14 04:00:00 +02:00
|
|
|
private static final Vector3f br = new Vector3f(0.0F, 0.0F, 0.0F);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -364,6 +373,21 @@
|
2017-05-14 04:00:00 +02:00
|
|
|
if (itemstack1.isEmpty() || (this.bB & 1 << enumitemslot.c() + 8) == 0) {
|
|
|
|
if (!itemstack1.isEmpty() || (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
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
2016-02-29 22:32:46 +01:00
|
|
|
itemstack2 = itemstack.cloneItemStack();
|
2016-12-03 22:32:13 +01:00
|
|
|
@@ -385,14 +409,19 @@
|
2014-11-29 17:05:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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)) {
|
2016-12-03 22:32:13 +01:00
|
|
|
- this.die();
|
2017-05-14 04:00:00 +02:00
|
|
|
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
2016-12-03 22:32:13 +01:00
|
|
|
return false;
|
2017-05-14 04:00:00 +02:00
|
|
|
} else if (!this.isInvulnerable(damagesource) && !this.bA && !this.isMarker()) {
|
2016-12-03 22:32:13 +01:00
|
|
|
if (damagesource.isExplosion()) {
|
2017-05-14 04:00:00 +02:00
|
|
|
this.F();
|
2016-12-03 22:32:13 +01:00
|
|
|
- this.die();
|
2017-05-14 04:00:00 +02:00
|
|
|
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
2016-12-03 22:32:13 +01:00
|
|
|
return false;
|
|
|
|
} else if (DamageSource.FIRE.equals(damagesource)) {
|
|
|
|
if (this.isBurning()) {
|
|
|
|
@@ -421,7 +450,7 @@
|
|
|
|
} else if (damagesource.u()) {
|
2017-05-14 04:00:00 +02:00
|
|
|
this.H();
|
2016-12-03 22:32:13 +01:00
|
|
|
this.D();
|
|
|
|
- this.die();
|
2017-05-14 04:00:00 +02:00
|
|
|
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
2016-12-03 22:32:13 +01:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
long i = this.world.getTime();
|
|
|
|
@@ -432,7 +461,7 @@
|
|
|
|
} else {
|
|
|
|
this.E();
|
|
|
|
this.D();
|
|
|
|
- this.die();
|
2017-05-14 04:00:00 +02:00
|
|
|
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
2016-12-03 22:32:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -460,7 +489,7 @@
|
2016-12-03 22:32:13 +01:00
|
|
|
f1 -= f;
|
|
|
|
if (f1 <= 0.5F) {
|
2017-05-14 04:00:00 +02:00
|
|
|
this.F();
|
2016-12-03 22:32:13 +01:00
|
|
|
- this.die();
|
2017-05-14 04:00:00 +02:00
|
|
|
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
2016-12-03 22:32:13 +01:00
|
|
|
} else {
|
|
|
|
this.setHealth(f1);
|
|
|
|
}
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -468,7 +497,7 @@
|
2016-12-03 22:32:13 +01:00
|
|
|
}
|
|
|
|
|
2017-05-14 04:00:00 +02:00
|
|
|
private void E() {
|
2016-12-03 22:32:13 +01:00
|
|
|
- Block.a(this.world, new BlockPosition(this), new ItemStack(Items.ARMOR_STAND));
|
|
|
|
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
|
2017-05-14 04:00:00 +02:00
|
|
|
this.F();
|
2016-12-03 22:32:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@@ -481,7 +510,7 @@
|
2017-05-14 04:00:00 +02:00
|
|
|
for (i = 0; i < this.by.size(); ++i) {
|
|
|
|
itemstack = (ItemStack) this.by.get(i);
|
2016-12-03 22:32:13 +01:00
|
|
|
if (!itemstack.isEmpty()) {
|
|
|
|
- Block.a(this.world, (new BlockPosition(this)).up(), itemstack);
|
|
|
|
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
2017-05-14 04:00:00 +02:00
|
|
|
this.by.set(i, ItemStack.a);
|
2016-12-03 22:32:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -489,7 +518,7 @@
|
2017-05-14 04:00:00 +02:00
|
|
|
for (i = 0; i < this.bz.size(); ++i) {
|
|
|
|
itemstack = (ItemStack) this.bz.get(i);
|
2016-12-03 22:32:13 +01:00
|
|
|
if (!itemstack.isEmpty()) {
|
|
|
|
- Block.a(this.world, (new BlockPosition(this)).up(), itemstack);
|
|
|
|
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
2017-05-14 04:00:00 +02:00
|
|
|
this.bz.set(i, ItemStack.a);
|
2016-12-03 22:32:13 +01:00
|
|
|
}
|
|
|
|
}
|
2017-06-09 07:51:56 +02:00
|
|
|
@@ -601,6 +630,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
public void killEntity() {
|
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event
|
|
|
|
this.die();
|
|
|
|
}
|
|
|
|
|
2017-10-13 12:36:32 +02:00
|
|
|
@@ -733,4 +763,11 @@
|
|
|
|
public boolean cS() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start - SPIGOT-3607
|
|
|
|
+ @Override
|
|
|
|
+ public float getHeadRotation() {
|
|
|
|
+ return this.yaw;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|