Add phantom creative and insomniac controls

This commit is contained in:
William Blake Galbreath
2020-04-25 15:13:41 -05:00
parent 56752585e8
commit 8a71e1c7da
3 changed files with 23 additions and 9 deletions

View File

@@ -24,10 +24,12 @@
}
@Override
@@ -219,6 +229,17 @@
return predicate.test(world, this, target);
}
@@ -217,7 +227,18 @@
boolean canAttack(ServerLevel world, LivingEntity target, TargetingConditions predicate) {
return predicate.test(world, this, target);
+ }
+
+ // Paper start
+ @Nullable
+ java.util.UUID spawningEntity;
@@ -35,14 +37,13 @@
+ @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 @@
@@ -522,14 +543,15 @@
List<Player> list = worldserver.getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {
@@ -55,6 +56,7 @@
if (Phantom.this.canAttack(worldserver, entityhuman, TargetingConditions.DEFAULT)) {
- Phantom.this.setTarget(entityhuman);
+ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(entityhuman)) // Paper - Add phantom creative and insomniac controls
+ Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
return true;
}