From 94d9ca472758bbc65f0f8c73c2b210bcb9d05dd7 Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Sun, 26 Sep 2021 05:31:21 -0700 Subject: [PATCH] Pull creating and dumping products out into their own methods (#6047) --- .../blocks/production/GenericCrafter.java | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index c6c688ae18..6df7ff8eca 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -127,24 +127,32 @@ public class GenericCrafter extends Block{ } if(progress >= 1f){ - consume(); - - if(outputItems != null){ - for(ItemStack output : outputItems){ - for(int i = 0; i < output.amount; i++){ - offload(output.item); - } - } - } - - if(outputLiquid != null){ - handleLiquid(this, outputLiquid.liquid, outputLiquid.amount); - } - - craftEffect.at(x, y); - progress %= 1f; + craft(); } + dumpOutputs(); + } + + public void craft(){ + consume(); + + if(outputItems != null){ + for(ItemStack output : outputItems){ + for(int i = 0; i < output.amount; i++){ + offload(output.item); + } + } + } + + if(outputLiquid != null){ + handleLiquid(this, outputLiquid.liquid, outputLiquid.amount); + } + + craftEffect.at(x, y); + progress %= 1f; + } + + public void dumpOutputs(){ if(outputItems != null && timer(timerDump, dumpTime / timeScale)){ for(ItemStack output : outputItems){ dump(output.item);