Add PhantomPreSpawnEvent

This commit is contained in:
BillyGalbreath
2018-08-25 19:56:51 -05:00
parent 1ef5dc7644
commit f6b20dccfc
3 changed files with 66 additions and 2 deletions

View File

@@ -1,6 +1,48 @@
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -522,14 +522,14 @@
@@ -161,6 +161,11 @@
}
this.setPhantomSize(nbt.getInt("Size"));
+ // Paper start
+ if (nbt.hasUUID("Paper.SpawningEntity")) {
+ this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
+ }
+ // Paper end
}
@Override
@@ -170,6 +175,11 @@
nbt.putInt("AY", this.anchorPoint.getY());
nbt.putInt("AZ", this.anchorPoint.getZ());
nbt.putInt("Size", this.getPhantomSize());
+ // Paper start
+ if (this.spawningEntity != null) {
+ nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
+ }
+ // Paper end
}
@Override
@@ -219,6 +229,17 @@
return predicate.test(world, this, target);
}
+ // Paper start
+ @Nullable
+ java.util.UUID spawningEntity;
+
+ @Nullable
+ public java.util.UUID getSpawningEntity() {
+ return this.spawningEntity;
+ }
+ public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
+ // Paper end
+
private static enum AttackPhase {
CIRCLE, SWOOP;
@@ -522,14 +543,14 @@
List<Player> list = worldserver.getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {