Fix #461 (iotas added to ravenmind not serialised properly), and make it so staff cast data only gets reset when both stack and ravenmind are clear. Also made it so writing null to the ravenmind clears it.
This commit is contained in:
parent
27abbadfd5
commit
13bfc65583
|
@ -97,7 +97,8 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
|
|||
|
||||
ExecutionClientView clientInfo = vm.queueExecuteAndWrapIota(new PatternIota(msg.pattern()), sender.getLevel());
|
||||
|
||||
if (clientInfo.isStackClear()) {
|
||||
// if (clientInfo.isStackClear()) {
|
||||
if (clientInfo.isStackClear() && clientInfo.getRavenmind() == null) {
|
||||
IXplatAbstractions.INSTANCE.setStaffcastImage(sender, null);
|
||||
IXplatAbstractions.INSTANCE.setPatterns(sender, List.of());
|
||||
} else {
|
||||
|
|
|
@ -6,8 +6,10 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
|
|||
import at.petrak.hexcasting.api.casting.eval.OperationResult
|
||||
import at.petrak.hexcasting.api.casting.eval.vm.CastingImage
|
||||
import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation
|
||||
import at.petrak.hexcasting.api.casting.iota.IotaType
|
||||
import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs
|
||||
import at.petrak.hexcasting.common.lib.hex.HexEvalSounds
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
|
||||
object OpPushLocal : Action {
|
||||
override fun operate(env: CastingEnvironment, image: CastingImage, continuation: SpellContinuation): OperationResult {
|
||||
|
@ -17,7 +19,10 @@ object OpPushLocal : Action {
|
|||
throw MishapNotEnoughArgs(1, 0)
|
||||
|
||||
val newLocal = stack.removeLast()
|
||||
image.userData.put(HexAPI.RAVENMIND_USERDATA, newLocal.serialize())
|
||||
if (newLocal.type == HexIotaTypes.NULL)
|
||||
image.userData.remove(HexAPI.RAVENMIND_USERDATA)
|
||||
else
|
||||
image.userData.put(HexAPI.RAVENMIND_USERDATA, IotaType.serialize(newLocal))
|
||||
|
||||
val image2 = image.withUsedOp().copy(stack = stack)
|
||||
return OperationResult(image2, listOf(), continuation, HexEvalSounds.NORMAL_EXECUTE)
|
||||
|
|
|
@ -52,7 +52,7 @@ public record MsgNewSpellPatternS2C(ExecutionClientView info, int index) impleme
|
|||
public static void handle(MsgNewSpellPatternS2C self) {
|
||||
Minecraft.getInstance().execute(() -> {
|
||||
var mc = Minecraft.getInstance();
|
||||
if (self.info().isStackClear()) {
|
||||
if (self.info().isStackClear() && self.info().getRavenmind() == null) {
|
||||
// don't pay attention to the screen, so it also stops when we die
|
||||
mc.getSoundManager().stop(HexSounds.CASTING_AMBIANCE.getLocation(), null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue