Exemplo n.º 1
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() {
    super.updateEntity();

    if (!CoreLib.isClient(this.worldObj)) {
      int var1 = 0;
      int var2 = 0;
      int var3 = 0;
      int var4 = 0;
      this.cacheCon();

      for (int var5 = 0; var5 < 6; ++var5) {
        if ((this.ConCache & 1 << var5) != 0) {
          WorldCoord var6 = new WorldCoord(this);
          var6.step(var5);
          Integer var7 = PipeLib.getPressure(this.worldObj, var6, var5 ^ 1);

          if (var7 != null) {
            var3 = Math.min(var7.intValue(), var3);
            var4 = Math.max(var7.intValue(), var4);
            var1 += var7.intValue();
            ++var2;
          }
        }
      }

      if (var2 == 0) {
        this.Pressure = 0;
      } else {
        if (var3 < 0) {
          ++var3;
        }

        if (var4 > 0) {
          --var4;
        }

        this.Pressure = Math.max(var3, Math.min(var4, var1 / var2 + Integer.signum(var1)));
      }

      PipeLib.movePipeLiquid(this.worldObj, this, new WorldCoord(this), this.ConCache);
      this.dirtyBlock();

      if (!CoreLib.isClient(this.worldObj) && (this.worldObj.getWorldTime() & 16L) == 0L) {
        this.sendItemUpdate();
      }
    }
  }