Update TooltipHandlerBurnTime.java

After performance profiling I found 
TileEntityFurnace.getItemBurnTime(item); 
is computationaly expensive. It occupied almost a cpu core forever, because NEI starts a task thread every few seconds and this line of code keep iteraing through all the furnance recipe in GTNH. Besides, usually the result of this computation is not useful.

Add thread name check will help performance and will not influence the player.
if (!Thread.currentThread().getName().startsWith("Client Thread")) return false;
This commit is contained in:
TataTawa authored and GitHub committed 2020-07-29 09:34:08 +00:00
1 parent ea5786c266
commit 3093ea6180
1 file changed
+1
@@ -51,6 +51,7 @@ public class TooltipHandlerBurnTime implements ITooltipCallback {
@Override
public boolean shouldHandleItem(ItemStack item) {
if (!Thread.currentThread().getName().startsWith("Client Thread")) return false;
int time = TileEntityFurnace.getItemBurnTime(item);
return time > 0 || isStirlingGen(item);
}