Remove dead var, add executeIota helper
This commit is contained in:
parent
fec005cb65
commit
9ad0a5cbe1
3 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue