Move Bukkit.Aware loading/saving to correct location

This commit is contained in:
md_5 2020-02-21 10:09:47 +11:00
parent f7cdb53c0e
commit b1ba874912

View file

@ -86,7 +86,13 @@
}
@Override
@@ -348,11 +396,20 @@
@@ -343,16 +391,26 @@
nbttagcompound.setBoolean("NoAI", this.isNoAI());
}
+ nbttagcompound.setBoolean("Bukkit.Aware", this.aware); // CraftBukkit
}
@Override
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
@ -109,7 +115,19 @@
NBTTagList nbttaglist;
int i;
@@ -406,6 +463,11 @@
@@ -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 @@
super.a(damagesource, flag);
this.lootTableKey = null;
}
@ -121,7 +139,7 @@
@Override
protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) {
@@ -465,11 +527,17 @@
@@ -465,11 +533,17 @@
ItemStack itemstack1 = this.getEquipment(enumitemslot);
boolean flag = this.a(itemstack, itemstack1, enumitemslot);
@ -140,7 +158,7 @@
}
this.setSlot(enumitemslot, itemstack);
@@ -554,11 +622,11 @@
@@ -554,11 +628,11 @@
if (entityhuman != null) {
double d0 = entityhuman.h(this);
@ -154,7 +172,7 @@
this.die();
} else if (d0 < 1024.0D) {
this.ticksFarFromPlayer = 0;
@@ -573,6 +641,7 @@
@@ -573,6 +647,7 @@
@Override
protected final void doTick() {
++this.ticksFarFromPlayer;
@ -162,7 +180,7 @@
this.world.getMethodProfiler().enter("sensing");
this.bw.a();
this.world.getMethodProfiler().exit();
@@ -951,12 +1020,24 @@
@@ -951,12 +1026,24 @@
if (!this.isAlive()) {
return false;
} else if (this.getLeashHolder() == entityhuman) {
@ -187,7 +205,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
@@ -1002,6 +1083,7 @@
@@ -1002,6 +1089,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -195,7 +213,7 @@
this.unleash(true, true);
}
@@ -1017,7 +1099,9 @@
@@ -1017,7 +1105,9 @@
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
@ -205,7 +223,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1086,6 +1170,7 @@
@@ -1086,6 +1176,7 @@
this.setLeashHolder(EntityLeash.a(this.world, blockposition), true);
} else {
@ -213,7 +231,7 @@
this.unleash(false, true);
}
@@ -1193,7 +1278,14 @@
@@ -1193,7 +1284,14 @@
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (i > 0) {
@ -229,27 +247,3 @@
}
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1252,4 +1344,23 @@
public boolean a(Item item) {
return this.getItemInMainHand().getItem() == item || this.getItemInOffHand().getItem() == item;
}
+
+ // CraftBukkit start
+ @Override
+ public NBTTagCompound save(NBTTagCompound nbttagcompound) {
+ super.save(nbttagcompound);
+
+ nbttagcompound.setBoolean("Bukkit.Aware", this.aware);
+ return nbttagcompound;
+ }
+
+ @Override
+ public void f(NBTTagCompound nbttagcompound) { // PAIL rename load
+ super.f(nbttagcompound);
+
+ if (nbttagcompound.hasKey("Bukkit.Aware")) {
+ this.aware = nbttagcompound.getBoolean("Bukkit.Aware");
+ }
+ }
+ // CraftBukkit end
}