2015-05-25 20:37:24 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								--- a/net/minecraft/server/EntityInsentient.java
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+++ b/net/minecraft/server/EntityInsentient.java
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -9,6 +9,18 @@
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 import java.util.UUID;
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-10 21:47:39 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 import javax.annotation.Nullable;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+// CraftBukkit start
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.craftbukkit.event.CraftEventFactory;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-28 17:47:59 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.entity.LivingEntity;
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityCombustByEntityEvent;
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-28 17:47:59 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityPickupItemEvent;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityTargetEvent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityUnleashEvent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+// CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 public abstract class EntityInsentient extends EntityLiving {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -27,7 +39,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public final float[] dropChanceHand;
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private final NonNullList<ItemStack> by;
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public final float[] dropChanceArmor;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-    private boolean canPickUpLoot;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    // private boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-26 08:34:52 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public boolean persistent;
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private final Map<PathType, Float> bB;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-26 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public MinecraftKey lootTableKey;
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-19 10:50:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -40,6 +52,8 @@
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     private BlockPosition bH;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     private float bI;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    public boolean aware = true; // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         super(entitytypes, world);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.bx = NonNullList.a(2, ItemStack.a);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@@ -63,6 +77,9 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             this.initPathfinder();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start - default persistance to type's persistance value
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        this.persistent = !isTypeNotPersistent(0);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     protected void initPathfinder() {}
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-19 10:50:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -130,7 +147,38 @@
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-10 21:47:39 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     public void setGoalTarget(@Nullable EntityLiving entityliving) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start - fire event
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    }
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-20 11:40:16 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+    public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        if (getGoalTarget() == entityliving) return false;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        if (fireEvent) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (reason == EntityTargetEvent.TargetReason.UNKNOWN) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                world.getServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            CraftLivingEntity ctarget = null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (entityliving != null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                ctarget = (CraftLivingEntity) entityliving.getBukkitEntity();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            world.getServer().getPluginManager().callEvent(event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (event.isCancelled()) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-20 11:40:16 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                return false;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (event.getTarget() != null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                entityliving = null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.goalTarget = entityliving;
							 | 
						
					
						
							
								
									
										
										
										
											2016-04-20 11:40:16 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        return true;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     @Override
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -343,16 +391,26 @@
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             nbttagcompound.setBoolean("NoAI", this.isNoAI());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        nbttagcompound.setBoolean("Bukkit.Aware", this.aware); // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     @Override
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     public void a(NBTTagCompound nbttagcompound) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         super.a(nbttagcompound);
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         if (nbttagcompound.hasKeyOfType("CanPickUpLoot", 1)) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-            this.setCanPickupLoot(nbttagcompound.getBoolean("CanPickUpLoot"));
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (isLevelAtLeast(nbttagcompound, 1) || data) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.setCanPickupLoot(data);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-        this.persistent = nbttagcompound.getBoolean("PersistenceRequired");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        boolean data = nbttagcompound.getBoolean("PersistenceRequired");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        if (isLevelAtLeast(nbttagcompound, 1) || data) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            this.persistent = data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         NBTTagList nbttaglist;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         int i;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -399,6 +457,11 @@
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.setNoAI(nbttagcompound.getBoolean("NoAI"));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        if (nbttagcompound.hasKey("Bukkit.Aware")) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            this.aware = nbttagcompound.getBoolean("Bukkit.Aware");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     @Override
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@@ -406,6 +469,11 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         super.a(damagesource, flag);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.lootTableKey = null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-12 18:39:51 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    // CraftBukkit - start
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    public MinecraftKey getLootTable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-26 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        return getDefaultLootTable();
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-12 18:39:51 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    // CraftBukkit - end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     @Override
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -465,11 +533,17 @@
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         ItemStack itemstack1 = this.getEquipment(enumitemslot);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         boolean flag = this.a(itemstack, itemstack1, enumitemslot);
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-28 17:47:59 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-        if (flag && this.g(itemstack)) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-28 17:47:59 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        boolean canPickup = flag && this.g(itemstack);
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-17 23:19:52 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        canPickup = !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, !canPickup).isCancelled();
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-28 17:47:59 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        if (canPickup) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit end
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             double d0 = (double) this.d(enumitemslot);
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-08 18:05:32 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-08 18:05:32 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.forceDrops = true; // CraftBukkit
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 this.a(itemstack1);
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-08 18:05:32 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.forceDrops = false; // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-14 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             this.setSlot(enumitemslot, itemstack);
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -554,11 +628,11 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             if (entityhuman != null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 double d0 = entityhuman.h(this);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-                if (d0 > 16384.0D && this.isTypeNotPersistent(d0)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                if (d0 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     this.die();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-                if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > 1024.0D && this.isTypeNotPersistent(d0)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     this.die();
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 } else if (d0 < 1024.0D) {
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                     this.ticksFarFromPlayer = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -573,6 +647,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-19 10:50:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     @Override
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     protected final void doTick() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         ++this.ticksFarFromPlayer;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        if (!this.aware) return; // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.world.getMethodProfiler().enter("sensing");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.bw.a();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.world.getMethodProfiler().exit();
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -951,12 +1026,24 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         if (!this.isAlive()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         } else if (this.getLeashHolder() == entityhuman) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit start - fire PlayerUnleashEntityEvent
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             return true;
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-17 12:41:03 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             ItemStack itemstack = entityhuman.b(enumhand);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                // CraftBukkit start - fire PlayerLeashEntityEvent
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 this.setLeashHolder(entityhuman, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 itemstack.subtract(1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 return true;
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1002,6 +1089,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-17 12:41:03 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         if (this.leashHolder != null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             if (!this.isAlive() || !this.leashHolder.isAlive()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 this.unleash(true, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1017,7 +1105,9 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-11 19:24:57 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             this.leashHolder = null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             if (!this.world.isClientSide && flag1) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                this.forceDrops = true; // CraftBukkit
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 this.a((IMaterial) Items.LEAD);
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-11 19:24:57 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.forceDrops = false; // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1086,6 +1176,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 this.setLeashHolder(EntityLeash.a(this.world, blockposition), true);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 this.unleash(false, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-21 10:09:47 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1193,7 +1284,14 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         if (i > 0) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-            entity.setOnFire(i * 4);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), i * 4);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            if (!combustEvent.isCancelled()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                entity.setOnFire(combustEvent.getDuration(), false);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
							 |