From 179eb6195d94dd558d1760fec5ab31849237136f Mon Sep 17 00:00:00 2001 From: bconlon Date: Tue, 23 Feb 2021 16:46:11 -0800 Subject: [PATCH] Cockatrices no longer target the player in creative mode. --- .../entities/hostile/EntityCockatrice.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gildedgames/the_aether/entities/hostile/EntityCockatrice.java b/src/main/java/com/gildedgames/the_aether/entities/hostile/EntityCockatrice.java index 97ac4b3..8704084 100644 --- a/src/main/java/com/gildedgames/the_aether/entities/hostile/EntityCockatrice.java +++ b/src/main/java/com/gildedgames/the_aether/entities/hostile/EntityCockatrice.java @@ -62,22 +62,26 @@ public class EntityCockatrice extends EntityMob { super.onUpdate(); if (this.getEntityToAttack() != null) { - - double d = this.getEntityToAttack().posX - this.posX; - double d1 = this.getEntityToAttack().posZ - this.posZ; - - this.getLookHelper().setLookPositionWithEntity(this.getEntityToAttack(), 30.0F, 30.0F); - - if (this.shootTime >= 20 && this.canEntityBeSeen(this.getEntityToAttack())) { - this.shootTarget(); - this.shootTime = -60; + if (this.getAttackTarget() instanceof EntityPlayer && ((EntityPlayer) this.getAttackTarget()).capabilities.isCreativeMode) { + this.setAttackTarget(null); } + else { + double d = this.getEntityToAttack().posX - this.posX; + double d1 = this.getEntityToAttack().posZ - this.posZ; - if (this.shootTime < 20) { - this.shootTime += 2; + this.getLookHelper().setLookPositionWithEntity(this.getEntityToAttack(), 30.0F, 30.0F); + + if (this.shootTime >= 20 && this.canEntityBeSeen(this.getEntityToAttack())) { + this.shootTarget(); + this.shootTime = -60; + } + + if (this.shootTime < 20) { + this.shootTime += 2; + } + + this.rotationYaw = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; } - - this.rotationYaw = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; } this.updateWingRotation();