Example #1
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    super.doPhysics(world, i, j, k, l);
    TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);

    if (tileentitychest != null) {
      tileentitychest.d();
    }
  }
  private void a(TileEntityChest tileentitychest, int i) {
    if (tileentitychest.r()) {
      this.a = false;
    } else if (this.a) {
      switch (i) {
        case 0:
          if (this.l != tileentitychest) {
            this.a = false;
          }
          break;

        case 1:
          if (this.k != tileentitychest) {
            this.a = false;
          }
          break;

        case 2:
          if (this.i != tileentitychest) {
            this.a = false;
          }
          break;

        case 3:
          if (this.j != tileentitychest) {
            this.a = false;
          }
      }
    }
  }
  private void a(TileEntityChest tileentitychest, int i0) {
    if (tileentitychest.r()) {
      this.a = false;
    } else if (this.a) {
      switch (i0) {
        case 0:
          if (this.e != tileentitychest) {
            this.a = false;
          }
          break;

        case 1:
          if (this.d != tileentitychest) {
            this.a = false;
          }
          break;

        case 2:
          if (this.b != tileentitychest) {
            this.a = false;
          }
          break;

        case 3:
          if (this.c != tileentitychest) {
            this.a = false;
          }
      }
    }
  }
Example #4
0
  public void remove(World world, int i, int j, int k) {
    TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);

    if (tileentitychest != null) {
      for (int l = 0; l < tileentitychest.getSize(); ++l) {
        ItemStack itemstack = tileentitychest.getItem(l);

        if (itemstack != null) {
          float f = this.a.nextFloat() * 0.8F + 0.1F;
          float f1 = this.a.nextFloat() * 0.8F + 0.1F;

          EntityItem entityitem;

          for (float f2 = this.a.nextFloat() * 0.8F + 0.1F;
              itemstack.count > 0;
              world.addEntity(entityitem)) {
            int i1 = this.a.nextInt(21) + 10;

            if (i1 > itemstack.count) {
              i1 = itemstack.count;
            }

            itemstack.count -= i1;
            entityitem =
                new EntityItem(
                    world,
                    (double) ((float) i + f),
                    (double) ((float) j + f1),
                    (double) ((float) k + f2),
                    new ItemStack(itemstack.id, i1, itemstack.getData()));
            float f3 = 0.05F;

            entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
            entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
            entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
            if (itemstack.n()) {
              entityitem.itemStack.d((NBTTagCompound) itemstack.o().b());
            }
          }
        }
      }
    }

    super.remove(world, i, j, k);
  }
Example #5
0
  @Override
  public boolean update(boolean force) {
    boolean result = super.update(force);

    if (result) {
      chest.update();
    }

    return result;
  }