Description

Playing BuildPaste with Relics (or another mod that fires its own container events) and your game crashes when you click an inventory slot after using the paste menu? Or the paste menu closes on its own? This mod fixes it.
What's wrong
BuildPaste shows its paste menu as a hidden chest minecart. It listens to every container event: "open" marks the menu as open, and anything else is taken as "closed", which removes that minecart. Relics fires a container event on every slot click, on both the client and the server, so:
- clicking an item can remove the paste menu's minecart, and
- in single player, a click in your own inventory removes it from the game's render thread. With C2ME installed the game then crashes with
ThreadLocalRandom accessed from a different thread (owner: Server thread, current: Render thread), pointing atGameEvents.ContainerEvent.
What this mod does
- BuildPaste's handler now only reacts to the real "container opened" and "container closed" events, and only on the server. Everything else it ignores.
- The paste menu still opens and closes exactly as before.
Good to know
- Install it wherever BuildPaste runs: in your game for single player, and on the server for multiplayer. It doesn't need to match between client and server.
- NeoForge 1.21.1, made for BuildPaste 2.0.3. Does nothing without BuildPaste.
Tested
Tested on NeoForge 21.1.266 in a 260-mod pack with BuildPaste 2.0.3 and Relics 0.10.7.8. Without this mod, a Relics slot click removed the paste menu's minecart; with it, the minecart stays, and the real open and close events still work.
Credits
An unofficial fix, not made by or affiliated with the authors of BuildPaste, Relics or C2ME; it contains none of their files. MIT license; the source is in the jar under sources/.