#1266: Add support for virtual entities

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2023-11-19 19:03:35 +13:00
parent 9a3c24e787
commit 95e4221adf
13 changed files with 472 additions and 61 deletions

View File

@@ -13,7 +13,29 @@
public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityBird {
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
@@ -242,7 +248,7 @@
@@ -187,12 +193,19 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
+ // CraftBukkit start - selectively save data
+ addAdditionalSaveData(nbttagcompound, true);
+ }
+
+ @Override
+ public void addAdditionalSaveData(NBTTagCompound nbttagcompound, boolean includeAll) {
+ // CraftBukkit end
super.addAdditionalSaveData(nbttagcompound);
- if (this.hasHive()) {
+ if (includeAll && this.hasHive()) { // CraftBukkit - selectively save hive
nbttagcompound.put("HivePos", GameProfileSerializer.writeBlockPos(this.getHivePos()));
}
- if (this.hasSavedFlowerPos()) {
+ if (includeAll && this.hasSavedFlowerPos()) { // CraftBukkit - selectively save flower
nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
}
@@ -242,7 +255,7 @@
}
if (b0 > 0) {
@@ -22,7 +44,7 @@
}
}
@@ -640,11 +646,14 @@
@@ -640,11 +653,14 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -39,7 +61,7 @@
}
}
@@ -999,7 +1008,7 @@
@@ -999,7 +1015,7 @@
e() {
super();
@@ -48,7 +70,7 @@
this.blacklistedTargets = Lists.newArrayList();
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1116,7 +1125,7 @@
@@ -1116,7 +1132,7 @@
f() {
super();
@@ -57,7 +79,7 @@
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1216,7 +1225,7 @@
@@ -1216,7 +1232,7 @@
}
}
@@ -66,7 +88,7 @@
EntityBee.this.level().levelEvent(2005, blockposition, 0);
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1289,7 +1298,7 @@
@@ -1289,7 +1305,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -75,7 +97,7 @@
}
}
@@ -1298,7 +1307,7 @@
@@ -1298,7 +1314,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {