コード例 #1
0
 @Override
 public void updateTask() {
   EntityEnderGuardian guardian = getEntity();
   if (guardian.getAttackTarget() != null) {
     guardian.getLookHelper().setLookPositionWithEntity(guardian.getAttackTarget(), 30, 30);
   }
 }
コード例 #2
0
  @Override
  public void resetTask() {
    cooldownTicks = 30;
    EntityEnderGuardian guardian = getEntity();
    if (guardian.getAttackTarget() != null) {
      Vec3 facing = guardian.getAttackTarget().getLook(1.0f);
      double x = guardian.getAttackTarget().posX - facing.xCoord * 3;
      double y = guardian.getAttackTarget().posY;
      double z = guardian.getAttackTarget().posZ - facing.zCoord * 3;

      guardian.setPosition(x, y, z);
      guardian.lastTickPosX = x;
      guardian.lastTickPosY = y;
      guardian.lastTickPosZ = z;
      guardian.worldObj.playSoundAtEntity(
          guardian,
          ((IArsMagicaBoss) guardian).getAttackSound(),
          1.0f,
          (float) (0.5 + guardian.getRNG().nextDouble() * 0.5f));
    }
    super.resetTask();
  }