So I have a TileEntity which I have based off the furnace tile entity.
However, the updateEntity() is only called on the server, and so when I call getBurnTimeRemainingScaled() on the Client it always returns 0. How can I fix this, as running updateEntity() on the Client is weird and glitchy, and the numbers do not correspond to the Server.
@Override
public void updateEntity(){
if(!this.worldObj.isRemote){ //this only runs on the server, the client does not get these variables.
if(!this.isBurning){
ItemStack stack = this.getStackInSlot(0);
if(this.isItemFuel(stack)){
this.fuelBurnTime = getItemBurnTime(stack);
this.generatorBurnTime = 0;
this.decrStackSize(0, 1);
this.markDirty();
this.setBurning();
}
}
if(this.isBurning){
this.generatorBurnTime += 4;
if(this.generatorBurnTime > this.fuelBurnTime){
this.generatorBurnTime = 0;
this.fuelBurnTime = 0;
this.isBurning = false;
}
if(this.isBurning){}
//this.receieveEnergy(null, 8, false); //side, amount, simulate
}
}
}
public int getBurnTimeRemainingScaled(int i){
if(this.fuelBurnTime != 0){
System.out.println("progress: "+ this.generatorBurnTime * i / this.fuelBurnTime);
return this.generatorBurnTime * i / this.fuelBurnTime;
}
System.out.println("returned 0");
return 0;
}
I know the Furnace tileentity has @SideOnly annotations, I left them out because I didn't know if they were the issue.
getBurnTimeRemainingScaled() is called from GuiGenerator on the Client side, and cannot access the server side information.