Shield blocks persisting after shape card is removed from the shield projector
adamissarcastic opened this issue ยท 7 comments
Using rftools-1.12-7.23. Shield persists without projector or power.
I created a large shield using a shape card in a fully infused tier 4 shield projector.
Spherical shield, 63 x 55 x 63 (9242 blocks max)
I cycled through all of the different appearance options turning the projector on and off to see what each looked like, then set it to a white "shield" texture.
When I attempted to turn it off again sometime after, the white shield is immovable and though I could turn the projector on and off with the wrench, and it works fine using the shield template blocks, the dome shield did not change whenever I did this. I can break all my shield projectors and it remains.
Edit: should have mentioned this is in the Direwolf20 1.12 pack version 1.7.1
Are you able to reproduce this in a new world? If so, can you post the exact steps that cause it?
I've been playing around. It seems that it happens often if I remove the space card in a projector before turning it off.
So if I use a space card to produce a shield, turn it on so the shield is projected and then remove the card, the shield persists with no RF cost and is fully functional as far as my setting went; it damaged and was solid to hostile mobs.
I play with cheats enabled for debugging purposes and in this case, mining the blocks in creative removed them just fine.
I have managed to recreate it in another world but I am still trying to figure out the exact steps.
Scratch that I've got it. It was a lot simpler than I thought.
If I shift+rightclick the card out of its slot in the projector the shield persists without cost or machine. If I click and move it, it never does this.
Doing anything else differently doesn't affect the outcome
When this is called by a shift-click, both stack
and inventoryHelper.getStackInSlot(index)
are empty.
The cause of this issue seems to be that GenericContainer#mergeItemStack
only calls Slot#onSlotChanged
to notify of its changes, and we don't listen for that. By the time something we do listen for happens, all that's left to do is basically a no-op.
Also, the handling of origStack
(which changes) and itemstack
in GenericContainer#transferStackInSlot
looks suspect.
This isn't as easy to fix as I thought. Even completely removing the empty checks won't work, because by the time that code runs, the shape card is already out, so we don't know where the blocks that we need to remove are at anymore. I don't see any way of fixing this other than digging into GenericContainer.
This will be fixed in the next release. If you haven't broken the shield projector, once you update, right-clicking on it with a wrench will remove any "stuck" shield blocks. If you have broken the shield projector, you'll need to use commands or creative mode to remove the "stuck" shield blocks.