/// <summary> /// 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. /// </summary> public override void UpdateEntity() { bool flag = FurnaceBurnTime > 0; bool flag1 = false; if (FurnaceBurnTime > 0) { FurnaceBurnTime--; } if (!WorldObj.IsRemote) { if (FurnaceBurnTime == 0 && CanSmelt()) { CurrentItemBurnTime = FurnaceBurnTime = GetItemBurnTime(FurnaceItemStacks[1]); if (FurnaceBurnTime > 0) { flag1 = true; if (FurnaceItemStacks[1] != null) { FurnaceItemStacks[1].StackSize--; if (FurnaceItemStacks[1].StackSize == 0) { FurnaceItemStacks[1] = null; } } } } if (IsBurning() && CanSmelt()) { FurnaceCookTime++; if (FurnaceCookTime == 200) { FurnaceCookTime = 0; SmeltItem(); flag1 = true; } } else { FurnaceCookTime = 0; } if (flag != (FurnaceBurnTime > 0)) { flag1 = true; BlockFurnace.UpdateFurnaceBlockState(FurnaceBurnTime > 0, WorldObj, XCoord, YCoord, ZCoord); } } if (flag1) { OnInventoryChanged(); } }
public override void updateEntity() { bool flag = furnaceBurnTime > 0; bool flag1 = false; if (furnaceBurnTime > 0) { furnaceBurnTime--; } if (!worldObj.singleplayerWorld) { if (furnaceBurnTime == 0 && canSmelt()) { currentItemBurnTime = furnaceBurnTime = getItemBurnTime(furnaceItemStacks[1]); if (furnaceBurnTime > 0) { flag1 = true; if (furnaceItemStacks[1] != null) { furnaceItemStacks[1].stackSize--; if (furnaceItemStacks[1].stackSize == 0) { furnaceItemStacks[1] = null; } } } } if (isBurning() && canSmelt()) { furnaceCookTime++; if (furnaceCookTime == 200) { furnaceCookTime = 0; smeltItem(); flag1 = true; } } else { furnaceCookTime = 0; } if (flag != (furnaceBurnTime > 0)) { flag1 = true; BlockFurnace.updateFurnaceBlockState(furnaceBurnTime > 0, worldObj, xCoord, yCoord, zCoord); } } if (flag1) { onInventoryChanged(); } }