fix stack mutability being a problem with certain ops
This commit is contained in:
parent
bdaa3d22c4
commit
4958dc1b23
2 changed files with 3 additions and 3 deletions
|
@ -33,11 +33,11 @@ object OpColorize : SpellOperator {
|
||||||
|
|
||||||
private object Spell : RenderedSpell {
|
private object Spell : RenderedSpell {
|
||||||
override fun cast(ctx: CastingContext) {
|
override fun cast(ctx: CastingContext) {
|
||||||
val (handStack) = ctx.getHeldItemToOperateOn { FrozenColorizer.isColorizer(it) }
|
val (handStack) = ctx.getHeldItemToOperateOn { FrozenColorizer.isColorizer(it) }.copy()
|
||||||
if (FrozenColorizer.isColorizer(handStack)) {
|
if (FrozenColorizer.isColorizer(handStack)) {
|
||||||
if (ctx.withdrawItem(handStack.item, 1, true)) {
|
if (ctx.withdrawItem(handStack.item, 1, true)) {
|
||||||
HexPlayerDataHelper.setColorizer(ctx.caster,
|
HexPlayerDataHelper.setColorizer(ctx.caster,
|
||||||
FrozenColorizer(handStack.copy(), ctx.caster.uuid)
|
FrozenColorizer(handStack, ctx.caster.uuid)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ object OpPlaceBlock : SpellOperator {
|
||||||
if (bstate.isAir || bstate.material.isReplaceable) {
|
if (bstate.isAir || bstate.material.isReplaceable) {
|
||||||
val placeeSlot = ctx.getOperativeSlot { it.item is BlockItem }
|
val placeeSlot = ctx.getOperativeSlot { it.item is BlockItem }
|
||||||
if (placeeSlot != null) {
|
if (placeeSlot != null) {
|
||||||
val placeeStack = ctx.caster.inventory.getItem(placeeSlot)
|
val placeeStack = ctx.caster.inventory.getItem(placeeSlot).copy()
|
||||||
val placee = placeeStack.item as BlockItem
|
val placee = placeeStack.item as BlockItem
|
||||||
if (ctx.withdrawItem(placee, 1, false)) {
|
if (ctx.withdrawItem(placee, 1, false)) {
|
||||||
// https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/spell/trick/block/PieceTrickPlaceBlock.java#L143
|
// https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/spell/trick/block/PieceTrickPlaceBlock.java#L143
|
||||||
|
|
Loading…
Reference in a new issue