Exemplo n.º 1
0
  public void addContents(int index, ItemStack is) {
    if (storage[index] == null) {
      storage[index] = is;

      if (charcoalFirepit != null)
        if (charcoalFirepit.isInactiveCharcoalFirepit())
          charcoalFirepit.logPileUpdate(is.stackSize);
        else setCharcoalFirepit(null);
    }
  }
Exemplo n.º 2
0
  public void injectContents(int index, int count) {
    if (storage[index] != null) {
      if (charcoalFirepit != null)
        if (charcoalFirepit.isInactiveCharcoalFirepit()) charcoalFirepit.logPileUpdate(count);
        else setCharcoalFirepit(null);

      storage[index] =
          new ItemStack(
              storage[index].getItem(),
              storage[index].stackSize + count,
              storage[index].getItemDamage());
    }
  }
Exemplo n.º 3
0
  @Override
  public ItemStack decrStackSize(int i, int j) {
    if (storage[i] != null) {
      if (storage[i].stackSize <= j) {
        ItemStack itemstack = storage[i];
        storage[i] = null;

        if (charcoalFirepit != null)
          if (charcoalFirepit.isInactiveCharcoalFirepit()) charcoalFirepit.logPileUpdate(-j);
          else setCharcoalFirepit(null);

        return itemstack;
      }
      ItemStack itemstack1 = storage[i].splitStack(j);
      if (storage[i].stackSize == 0) storage[i] = null;

      if (charcoalFirepit != null)
        if (charcoalFirepit.isInactiveCharcoalFirepit()) charcoalFirepit.logPileUpdate(-j);
        else setCharcoalFirepit(null);

      return itemstack1;
    } else return null;
  }
Exemplo n.º 4
0
  public void ejectContents() {
    float f3 = 0.05F;
    EntityItem entityitem;
    Random rand = new Random();
    float f = rand.nextFloat() * 0.8F + 0.1F;
    float f1 = rand.nextFloat() * 2.0F + 0.4F;
    float f2 = rand.nextFloat() * 0.8F + 0.1F;

    if (charcoalFirepit != null)
      if (charcoalFirepit.isInactiveCharcoalFirepit())
        charcoalFirepit.logPileUpdate(-getNumberOfLogs());
      else setCharcoalFirepit(null);

    for (int i = 0; i < getSizeInventory(); i++)
      if (storage[i] != null) {
        entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + f2, storage[i]);
        entityitem.motionX = (float) rand.nextGaussian() * f3;
        entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
        entityitem.motionZ = (float) rand.nextGaussian() * f3;
        worldObj.spawnEntityInWorld(entityitem);
      }

    extinguishFire();
  }