@Override public void onUpdate() { super.onUpdate(); if (getRunning()) run(); else postRun(); if (Config.useFuel && !worldObj.isRemote) { if (inventory.getStackInSlot(0) != null && TileEntityFurnace.isItemFuel(inventory.getStackInSlot(0)) && (fuel.get() + TileEntityFurnace.getItemBurnTime(inventory.getStackInSlot(0))) <= Config.maxFuelLevel) if (inventory.getStackInSlot(0).getItem().equals(Items.lava_bucket)) { fuel.modify(TileEntityFurnace.getItemBurnTime(inventory.decrStackSize(0, 1))); inventory.setInventorySlotContents(0, new ItemStack(Items.bucket)); } else { fuel.modify(TileEntityFurnace.getItemBurnTime(inventory.decrStackSize(0, 1))); } if (fuel.isDirty()) sync(); } lastTickPosX = posX; lastTickPosY = posY; lastTickPosZ = posZ; posX += motionX; posY += motionY; posZ += motionZ; setPosition(posX, posY, posZ); if (getTimeSinceHit() > 0) setTimeSinceHit(getTimeSinceHit() - 1); if (getDamageTaken() > 0) setDamageTaken(getDamageTaken() - 1); }
private boolean placeBlock(BlockCoord coord) { if (worldObj .getBlock(coord.x, coord.y, coord.z) .canPlaceBlockAt(worldObj, coord.x, coord.y, coord.z)) { slot++; if (slot > 9) slot = 1; if (inventory.getStackInSlot(slot) != null) { ItemStack stack = inventory.getStackInSlot(slot); if (!(stack.getItem() instanceof ItemBlock)) return false; stack = inventory.decrStackSize(slot, 1); return worldObj.setBlock( coord.x, coord.y, coord.z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } } return false; }