From 76f81910c406422867896b5275e52a9820204a2e Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 27 Apr 2020 14:44:57 +0200 Subject: [PATCH] SGS hotfix - Fixed Sequenced Gearshift crashing when removing instructions while active --- .../advanced/sequencer/SequencedGearshiftTileEntity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java index b50f20dbd..26453997c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java @@ -50,6 +50,8 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity { Instruction instruction = getInstruction(currentInstruction); if (instruction == null) return; + if (getSpeed() == 0) + run(-1); // Update instruction time with regards to new speed float initialProgress = timer / (float) currentInstructionDuration; @@ -68,6 +70,8 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity { world.setBlockState(pos, getBlockState().with(SequencedGearshiftBlock.STATE, 0), 3); return; } + if (getSpeed() == 0) + return; run(0); } @@ -122,6 +126,8 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity { } public int getModifier() { + if (currentInstruction >= instructions.size()) + return 0; return isIdle() ? 0 : instructions.get(currentInstruction).getSpeedModifier(); }