From 4192d721a03e7d7a113247c87600c87372a08845 Mon Sep 17 00:00:00 2001 From: PrototypeTrousers Date: Mon, 28 Feb 2022 21:25:33 -0300 Subject: [PATCH] only fire simulation if a player requested it --- .../java/appeng/crafting/CraftingJob.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/appeng/crafting/CraftingJob.java b/src/main/java/appeng/crafting/CraftingJob.java index 2f0d450d4..b4a4d6cf6 100644 --- a/src/main/java/appeng/crafting/CraftingJob.java +++ b/src/main/java/appeng/crafting/CraftingJob.java @@ -175,23 +175,26 @@ public class CraftingJob implements Runnable, ICraftingJob try { - final Stopwatch timer = Stopwatch.createStarted(); - final MECraftingInventory craftingInventory = new MECraftingInventory( this.original, true, false, true ); - craftingInventory.ignore( this.output ); - - this.availableCheck = new MECraftingInventory( this.original, false, false, false ); - - this.getTree().setSimulate(); - this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc ); - this.getTree().dive( this ); - - for( final String s : this.opsAndMultiplier.keySet() ) + if( actionSrc.player().isPresent() ) { - final TwoIntegers ti = this.opsAndMultiplier.get( s ); - AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) ); - } + final Stopwatch timer = Stopwatch.createStarted(); + final MECraftingInventory craftingInventory = new MECraftingInventory( this.original, true, false, true ); + craftingInventory.ignore( this.output ); - this.logCraftingJob( "simulate", timer ); + this.availableCheck = new MECraftingInventory( this.original, false, false, false ); + + this.getTree().setSimulate(); + this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc ); + this.getTree().dive( this ); + + for( final String s : this.opsAndMultiplier.keySet() ) + { + final TwoIntegers ti = this.opsAndMultiplier.get( s ); + AELog.crafting( s + " * " + ti.times + " = " + ( ti.perOp * ti.times ) ); + } + + this.logCraftingJob( "simulate", timer ); + } } catch( final CraftBranchFailure e1 ) {