@Override
 public void updateEntity() {
   super.updateEntity();
   if (this.grindingTicks > 0) { // We have work. This should NOT be 180.
     ++this.grindingTicks;
     if (this.grindingTicks == grindingTicksNeeded) {
       if (this.getStackInSlot(1) == null) {
         this.setInventorySlotContents(1, new ItemStack(modnh.itemFlour, 3));
       } else {
         this.getStackInSlot(1).stackSize += 3;
       }
       this.grindingTicks = 0;
     }
   }
   if (this.grindingTicks == 0) { // We aren't working, or we just finished
     ItemStack stack = this.getStackInSlot(0);
     if (stack == null) return;
     if (stack.itemID == Item.wheat.shiftedIndex) {
       ItemStack out = this.getStackInSlot(1);
       if (out != null) {
         if (out.stackSize + 3 > 64) return;
       }
       this.decrStackSize(0, 1);
       this.grindingTicks = 1;
     }
   }
 }
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (this.brewTime > 0) {
      --this.brewTime;

      if (this.brewTime == 0) {
        this.brewPotions();
        this.onInventoryChanged();
      } else if (!this.canBrew()) {
        this.brewTime = 0;
        this.onInventoryChanged();
      } else if (this.ingredientID != this.brewingItemStacks[3].itemID) {
        this.brewTime = 0;
        this.onInventoryChanged();
      }
    } else if (this.canBrew()) {
      this.brewTime = 400;
      this.ingredientID = this.brewingItemStacks[3].itemID;
    }

    int var1 = this.getFilledSlots();

    if (var1 != this.filledSlots) {
      this.filledSlots = var1;
      this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, var1, 2);
    }

    super.updateEntity();
  }
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    super.updateEntity();

    if (++this.ticksSinceSync % 20 * 4 == 0) {;
    }

    //        this.prevLidAngle = this.lidAngle;
    float var1 = 0.1F;
    double var4;
  }
  public void updateEntity() {
    if (this.fossilProgress > 0 || this.pokemonProgress > 0) {
      completionRate = ((int) (((fossilProgress + pokemonProgress) * 2) / 96));
    }
    if (this.currentFossil != -1) {
      if (this.fossilTicks < 0) ++fossilTicks;
      if (this.fossilTicks == 0 && fossilProgress != fossilMaxProgress) {
        fossilTicks = 0;
        fossilProgress++;
      } else if (fossilProgress >= fossilMaxProgress) {
        swapFossilForPokemon();
      }
    }
    if (pokemonOccupied) {
      if (this.pokemonTicks < 0) ++pokemonTicks;
      if (this.pokemonTicks == 0 && pokemonProgress != pokemonMaxProgress) {
        pokemonTicks = 0;
        pokemonProgress++;
      }
    }

    if (this.dotTicks < 10) {
      dotTicks++;
    } else if (dots.length() <= 6) {
      this.dotTicks = 0;
      this.dots = dots + ".";
    }
    if (dots.length() >= 6) {
      this.dotTicks = 0;
      this.dots = "";
    }

    if (y == 0) y += 0.01;
    else y = 0;
    if (displayFlicker <= 0.8f && displayFlicker2 == 0) {
      this.staticFlicker = true;
      displayFlicker += 0.1f;
    }
    if (displayFlicker >= 0.8f) {
      displayFlicker2 += 0.1f;
    }
    if (displayFlicker2 >= 0.5f) {
      this.staticFlicker = false;
      displayFlicker = 0;
      displayFlicker2 = 0;
    }

    if (shinyChance == 1) this.isShiny = true;
    super.updateEntity();
  }
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (!anyPlayerInRange()) {
      return;
    }

    if (worldObj.isRemote) {
      double d = (float) xCoord + worldObj.rand.nextFloat();
      double d1 = (float) yCoord + worldObj.rand.nextFloat();
      double d3 = (float) zCoord + worldObj.rand.nextFloat();
      worldObj.spawnParticle("smoke", d, d1, d3, 0.0D, 0.0D, 0.0D);
      worldObj.spawnParticle("flame", d, d1, d3, 0.0D, 0.0D, 0.0D);
      yaw2 = yaw % 360D;
      yaw += 4.5454545021057129D;
    } else {
      if (delay == -1) {
        updateDelay();
      }

      if (delay > 0) {
        delay--;
        return;
      }

      for (int i = 0; i < field_70395_h; i++) {
        Entity entity = EntityList.createEntityByName(mobID, worldObj);

        if (entity == null) {
          return;
        }

        int j =
            worldObj
                .getEntitiesWithinAABB(
                    entity.getClass(),
                    AxisAlignedBB.getAABBPool()
                        .addOrModifyAABBInPool(
                            xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)
                        .expand(8D, 4D, 8D))
                .size();

        if (j >= 6) {
          updateDelay();
          return;
        }

        if (entity == null) {
          continue;
        }

        double d2 =
            (double) xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        double d4 = (yCoord + worldObj.rand.nextInt(3)) - 1;
        double d5 =
            (double) zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        EntityLiving entityliving = (entity instanceof EntityLiving) ? (EntityLiving) entity : null;
        entity.setLocationAndAngles(d2, d4, d5, worldObj.rand.nextFloat() * 360F, 0.0F);

        if (entityliving != null && !entityliving.getCanSpawnHere()) {
          continue;
        }

        func_70383_a(entity);
        worldObj.spawnEntityInWorld(entity);
        worldObj.playAuxSFX(2004, xCoord, yCoord, zCoord, 0);

        if (entityliving != null) {
          entityliving.spawnExplosionParticle();
        }

        updateDelay();
      }
    }

    super.updateEntity();
  }
예제 #6
0
  @Override
  public void updateEntity() {

    super.updateEntity();
    addToChunkStore();
  }
예제 #7
0
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (this.anyPlayerInRange()) {
      if (this.worldObj.isRemote) {
        double var1 = (double) ((float) this.xCoord + this.worldObj.rand.nextFloat());
        double var3 = (double) ((float) this.yCoord + this.worldObj.rand.nextFloat());
        double var5 = (double) ((float) this.zCoord + this.worldObj.rand.nextFloat());
        this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
        this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);

        if (this.delay > 0) {
          --this.delay;
        }

        this.yaw2 = this.yaw;
        this.yaw = (this.yaw + (double) (1000.0F / ((float) this.delay + 200.0F))) % 360.0D;
      } else {
        if (this.delay == -1) {
          this.updateDelay();
        }

        if (this.delay > 0) {
          --this.delay;
          return;
        }

        for (int var11 = 0; var11 < this.spawnCount; ++var11) {
          Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);

          if (var2 == null) {
            return;
          }

          int var12 =
              this.worldObj
                  .getEntitiesWithinAABB(
                      var2.getClass(),
                      AxisAlignedBB.getAABBPool()
                          .addOrModifyAABBInPool(
                              (double) this.xCoord,
                              (double) this.yCoord,
                              (double) this.zCoord,
                              (double) (this.xCoord + 1),
                              (double) (this.yCoord + 1),
                              (double) (this.zCoord + 1))
                          .expand(
                              (double) (this.field_82348_s * 2),
                              4.0D,
                              (double) (this.field_82348_s * 2)))
                  .size();

          if (var12 >= this.field_82350_j) {
            this.updateDelay();
            return;
          }

          if (var2 != null) {
            double var4 =
                (double) this.xCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            double var6 = (double) (this.yCoord + this.worldObj.rand.nextInt(3) - 1);
            double var8 =
                (double) this.zCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            EntityLiving var10 = var2 instanceof EntityLiving ? (EntityLiving) var2 : null;
            var2.setLocationAndAngles(
                var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);

            if (var10 == null || var10.getCanSpawnHere()) {
              this.writeNBTTagsTo(var2);
              this.worldObj.spawnEntityInWorld(var2);
              this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);

              if (var10 != null) {
                var10.spawnExplosionParticle();
              }

              this.updateDelay();
            }
          }
        }
      }

      super.updateEntity();
    }
  }