From fdc7f0468f2551b7f4b9fbc7d22354acb5d0b447 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 22 Jun 2022 10:26:32 -0400 Subject: [PATCH] Fixed #7057 --- core/src/mindustry/world/blocks/units/UnitFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index 31572b6e05..ce1afc67f1 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -60,7 +60,7 @@ public class UnitFactory extends UnitBlock{ tile.progress = 0; }); - consume(new ConsumeItemDynamic((UnitFactoryBuild e) -> e.currentPlan != -1 ? plans.get(e.currentPlan).requirements : ItemStack.empty)); + consume(new ConsumeItemDynamic((UnitFactoryBuild e) -> e.currentPlan != -1 ? plans.get(Math.min(e.currentPlan, plans.size - 1)).requirements : ItemStack.empty)); } @Override