Ejemplo n.º 1
0
  protected void updateEntityActionState() {
    if (count == 0) {
      int wdepth = WorldHelper.getWaterDepth((int) posX, (int) posY, (int) posZ, worldObj);
      // if (rand.nextInt(90) == 0 || randomMotionVecX == 0.0F
      // && randomMotionVecY == 0.0F && randomMotionVecZ == 0.0F) {
      count = refreshRate - refreshRate / 2 + rand.nextInt(refreshRate / 2);
      randomMotionVecX = (-0.5f + rand.nextFloat()) * 0.2F;
      if (wdepth >= depthRangeEnd) randomMotionVecY = (0.02F + rand.nextFloat()) * 0.1F;
      else if (wdepth <= depthRangeStart) randomMotionVecY = (-0.02F + rand.nextFloat()) * 0.1F;
      else randomMotionVecY = rand.nextFloat() * 0.1F;
      randomMotionVecZ = (-0.5f + rand.nextFloat()) * 0.2F;
    }
    count--;

    despawnEntity();
  }
Ejemplo n.º 2
0
 /** Checks if the entity's current position is a valid location to spawn this entity. */
 public boolean getCanSpawnHere() {
   int wdepth = WorldHelper.getWaterDepth((int) posX, (int) posY, (int) posZ, worldObj);
   if (wdepth >= depthRangeStart && wdepth < depthRangeEnd) return true;
   return false;
 }