@Override public void updateEntity() { if (!worldObj.isRemote) { CreateTuyereBlock(); if (oreCount < 0) oreCount = 0; if (charcoalCount < 0) charcoalCount = 0; /* Create a list of all the items that are falling into the stack */ List list = worldObj.getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( xCoord, yCoord, zCoord, xCoord + 1, yCoord + moltenCount + 1.1, zCoord + 1)); /*Create a list of any players that are inside the chimney*/ List playerList = worldObj.getEntitiesWithinAABB( EntityPlayer.class, AxisAlignedBB.getBoundingBox( xCoord, yCoord, zCoord, xCoord + 1, yCoord + moltenCount + 1.1, zCoord + 1)); if (moltenCount == 0) moltenCount = 1; /* * Make sure the list isn't null or empty and that the stack is * valid 1 layer above the Molten Ore */ if (list != null && !list.isEmpty() && ((BlockBlastFurnace) TFCBlocks.BlastFurnace) .checkStackAt(worldObj, xCoord, yCoord + moltenCount, zCoord) && (playerList == null || playerList.isEmpty())) { /* * Iterate through the list and check for charcoal, coke, and * ore */ for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { EntityItem entity = (EntityItem) iterator.next(); boolean _isOre = TFC_Core.isOreIron(entity.getEntityItem()); if (entity.getEntityItem().getItem() == TFCItems.Coal && entity.getEntityItem().getItemDamage() == 1 || entity.getEntityItem().getItem() == TFCItems.Coke) { for (int c = 0; c < entity.getEntityItem().stackSize; c++) { if (getTotalCount() < 40 && charcoalCount < (this.maxValidStackSize * 4)) { charcoalCount++; entity.getEntityItem().stackSize--; } } if (entity.getEntityItem().stackSize == 0) entity.setDead(); } /* * If the item that's been tossed in is a type of Ore and it * can melt down into something then add the ore to the list * of items in the fire. */ else if ((TFC_ItemHeat.IsCookable(entity.getEntityItem()) != -1 && _isOre) || (!_isOre && entity.getEntityItem().getItem() instanceof ISmeltable)) { int c = entity.getEntityItem().stackSize; int nonConsumedOre = 0; for (; c > 0; c--) { if (getTotalCount() < 40 && oreCount < (this.maxValidStackSize * 4)) { if (foundFlux(moltenCount) && AddOreToFire( new ItemStack( entity.getEntityItem().getItem(), 1, entity.getEntityItem().getItemDamage()))) oreCount += 1; else nonConsumedOre++; } else { nonConsumedOre++; } } if (c + nonConsumedOre == 0) entity.setDead(); else { ItemStack is = entity.getEntityItem(); is.stackSize = c + nonConsumedOre; entity.setEntityItemStack(is); } } } } /* Handle the temperature of the Bloomery */ HandleTemperature(); if (cookDelay > 0) cookDelay--; for (int i = 0; i < fireItemStacks.length && isValid; i++) { /* Handle temperature for each item in the stack */ careForInventorySlot(fireItemStacks[i]); /* Cook each input item */ if (worldObj.getBlock(xCoord, yCoord - 1, zCoord) == TFCBlocks.Crucible) { CookItem(i); } } // Every 5 seconds we do a validity check and update the molten ore // count if (slowCounter > 100) { // Here we make sure that the forge is valid isValid = CheckValidity(); moltenCount = updateMoltenBlocks(); } slowCounter++; } }