Tinker I/O

Tinker I/O

13M Downloads

Smart Output CPU usage while idle

CplPibald opened this issue ยท 1 comments

commented

When a Smart Output is idle because it doesn't have any fluid to process, it uses more CPU than it needs to.

Every tick on update() the SO calls canFrozen() which calls canCast(), which calls updateRecipe(), which searches the TConstruct recipe registry for any recipe that matches. When the tank is empty, no recipe will ever match, so we can save some processing by not checking the recipe in this case.

https://github.com/gkbm2013/tinker-IO/blob/1.12.2/src/java/tinker_io/TileEntity/SOTileEntity.java#L527

	public boolean canFrozen(){
		if (tank.getFluidAmount() == 0) { return false; }
		
		boolean hasPowered = world.isBlockPowered(this.pos);
		boolean canStart = false;

		...

Adding one line above should reduce the CPU usage of an SO most of the time when it doesn't have any fluid in it.

commented

Actually, this looks like it was mostly fixed with #50