From 9ad0a5cbe1832723d183f87bb1218aee3ccb5ac8 Mon Sep 17 00:00:00 2001 From: Alwinfy <20421383+Alwinfy@users.noreply.github.com> Date: Mon, 23 May 2022 15:59:28 -0400 Subject: [PATCH] Remove dead var, add executeIota helper --- .../api/block/circle/BlockEntityAbstractImpetus.java | 3 +-- .../at/petrak/hexcasting/api/spell/casting/CastingHarness.kt | 5 +++++ .../hexcasting/common/network/MsgNewSpellPatternSyn.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java index a46e0609..a0dac65a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java @@ -278,7 +278,6 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen new SpellCircleContext(this.getBlockPos(), bounds, this.activatorAlwaysInRange())); var harness = new CastingHarness(ctx); - var castSpell = false; var makeSound = false; BlockPos erroredPos = null; for (var tracked : this.trackedBlocks) { @@ -286,7 +285,7 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen if (bs.getBlock() instanceof BlockCircleComponent cc) { var newPattern = cc.getPattern(tracked, bs, this.level); if (newPattern != null) { - var info = harness.executeIotas(List.of(SpellDatum.make(newPattern)), splayer.getLevel()); + var info = harness.executeIota(SpellDatum.make(newPattern), splayer.getLevel()); if (info.getMakesCastSound()) { makeSound = true; } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index d383ffb5..0bcc96be 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -53,6 +53,11 @@ class CastingHarness private constructor( prepackagedColorizer: FrozenColorizer? = null ) : this(mutableListOf(), SpellDatum.make(Widget.NULL), 0, mutableListOf(), false, ctx, prepackagedColorizer) + /** + * Execute a single iota. + */ + fun executeIota(iota: SpellDatum<*>, world: ServerLevel): ControllerInfo = executeIotas(listOf(iota), world) + /** * Given a list of iotas, execute them in sequence. */ diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java index 5955d677..8f01bc92 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java @@ -85,7 +85,7 @@ public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern clientInfo = new ControllerInfo(false, harness.getStack().isEmpty(), ResolvedPatternType.INVALID, harness.generateDescs()); } else { - clientInfo = harness.executeIotas(List.of(SpellDatum.make(this.pattern)), sender.getLevel()); + clientInfo = harness.executeIota(SpellDatum.make(this.pattern), sender.getLevel()); if (clientInfo.getMakesCastSound()) { sender.level.playSound(null, sender.getX(), sender.getY(), sender.getZ(),