@@ -17,7 +17,7 @@
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
public abstract class EntityInsentient extends EntityLiving implements Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -121,6 +134,8 @@
|
||||
@@ -42,7 +42,7 @@
|
||||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -224,7 +245,38 @@
|
||||
@@ -254,7 +275,38 @@
|
||||
}
|
||||
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -364,6 +416,12 @@
|
||||
@@ -394,6 +446,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -453,16 +511,26 @@
|
||||
@@ -483,16 +541,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -509,6 +577,11 @@
|
||||
@@ -539,6 +607,11 @@
|
||||
}
|
||||
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
@@ -135,7 +135,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -576,7 +649,7 @@
|
||||
@@ -606,7 +679,7 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.onItemPickup(entityitem);
|
||||
@@ -590,15 +663,29 @@
|
||||
@@ -620,6 +693,12 @@
|
||||
}
|
||||
|
||||
public ItemStack equipItemIfPossible(ItemStack itemstack) {
|
||||
@@ -154,9 +154,12 @@
|
||||
+
|
||||
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItemStack(itemstack);
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -630,11 +709,19 @@
|
||||
flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
}
|
||||
|
||||
- if (flag && this.canHoldItem(itemstack)) {
|
||||
+ // CraftBukkit start
|
||||
@@ -175,7 +178,7 @@
|
||||
}
|
||||
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -750,6 +837,7 @@
|
||||
@@ -779,6 +866,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
@@ -183,7 +186,7 @@
|
||||
this.level.getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level.getProfiler().pop();
|
||||
@@ -1143,6 +1231,12 @@
|
||||
@@ -1172,6 +1260,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
@@ -194,9 +197,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else {
|
||||
@@ -1166,6 +1260,12 @@
|
||||
@@ -1197,6 +1291,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
@@ -209,7 +212,7 @@
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1181,7 +1281,7 @@
|
||||
@@ -1212,7 +1312,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
@@ -218,7 +221,7 @@
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1231,12 +1331,19 @@
|
||||
@@ -1262,12 +1362,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
@@ -239,7 +242,7 @@
|
||||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1271,7 +1378,12 @@
|
||||
@@ -1302,7 +1409,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +256,7 @@
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1292,6 +1404,7 @@
|
||||
@@ -1323,6 +1435,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
@@ -261,7 +264,7 @@
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1303,7 +1416,9 @@
|
||||
@@ -1334,7 +1447,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
@@ -271,7 +274,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
|
||||
@@ -1353,6 +1468,7 @@
|
||||
@@ -1384,6 +1499,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
@@ -279,7 +282,7 @@
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1377,7 +1493,9 @@
|
||||
@@ -1408,7 +1524,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
@@ -289,7 +292,7 @@
|
||||
this.leashInfoTag = null;
|
||||
}
|
||||
}
|
||||
@@ -1458,7 +1576,14 @@
|
||||
@@ -1484,7 +1602,14 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -304,8 +307,8 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
|
||||
@@ -1532,9 +1657,10 @@
|
||||
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
|
||||
@@ -1558,9 +1683,10 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
|
||||
Reference in New Issue
Block a user