public void setColor(int color) {
   if (this.id > 0) {
     myChest = BoundChestWorldData.get(this.worldObj, "id" + this.id, 0);
   }
   if (myChest != null) {
     myChest.setSealColor(color);
   }
 }
  /**
   * 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();
    ++this.ticksSinceSync;
    if (this.accessTicks > 0 && !this.worldObj.isRemote) {
      --this.accessTicks;
      this.updateAccessTicks();
    }
    float f;
    if (this.id > 0) {
      myChest = BoundChestWorldData.get(this.worldObj, "id" + this.id, 0);
    }
    if (myChest != null) {
      if (this.chestContents != myChest.getChestContents()) {
        this.accessTicks = 80;
        this.updateAccessTicks();
      }
      this.chestContents = myChest.getChestContents();
    }
    if (!this.worldObj.isRemote
        && this.numUsingPlayers != 0
        && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) {
      this.numUsingPlayers = 0;
      f = 5.0F;
      List list =
          this.worldObj.getEntitiesWithinAABB(
              EntityPlayer.class,
              AxisAlignedBB.getAABBPool()
                  .getAABB(
                      (double) ((float) this.xCoord - f),
                      (double) ((float) this.yCoord - f),
                      (double) ((float) this.zCoord - f),
                      (double) ((float) (this.xCoord + 1) + f),
                      (double) ((float) (this.yCoord + 1) + f),
                      (double) ((float) (this.zCoord + 1) + f)));
      Iterator iterator = list.iterator();

      while (iterator.hasNext()) {
        EntityPlayer entityplayer = (EntityPlayer) iterator.next();

        if (entityplayer.openContainer instanceof ContainerChest) {
          IInventory iinventory =
              ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();

          if (iinventory == this
              || iinventory instanceof InventoryLargeChest
                  && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this)) {
            ++this.numUsingPlayers;
          }
        }
      }
    }

    this.prevLidAngle = this.lidAngle;
    f = 0.1F;
    double d0;

    if (this.numUsingPlayers > 0 && this.lidAngle == 0.0F) {
      double d1 = (double) this.xCoord + 0.5D;
      d0 = (double) this.zCoord + 0.5D;

      this.worldObj.playSoundEffect(
          d1,
          (double) this.yCoord + 0.5D,
          d0,
          "random.chestopen",
          0.5F,
          this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
    }

    if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F
        || this.numUsingPlayers > 0 && this.lidAngle < 1.0F) {
      float f1 = this.lidAngle;

      if (this.numUsingPlayers > 0) {
        this.lidAngle += f;
      } else {
        this.lidAngle -= f;
      }

      if (this.lidAngle > 1.0F) {
        this.lidAngle = 1.0F;
      }

      float f2 = 0.5F;

      if (this.lidAngle < f2 && f1 >= f2) {
        d0 = (double) this.xCoord + 0.5D;
        double d2 = (double) this.zCoord + 0.5D;

        this.worldObj.playSoundEffect(
            d0,
            (double) this.yCoord + 0.5D,
            d2,
            "random.chestclosed",
            0.5F,
            this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
      }

      if (this.lidAngle < 0.0F) {
        this.lidAngle = 0.0F;
      }
    }
  }