Pasting in survival
IoakeimSogiakas opened this issue ยท 2 comments
I am aware that the mode is made for use in creative. Is there a way to modify the code to work with survival like adjusting the source file (I could do the work myself if needed; i need to know where to look or what to change). My idea of this is to work as follows if the player has all the necessary blocks (except the ones he sets to ignore) the mode should let him "copy" the schematic to his survival world and use all the blocks from his inventory.
Simply allowing the current pasting behavior in survival would be more or less a one line change, but if you want the mod to also consume the items, then that's a whole another thing entirely.
I would almost just recommend using one of the printer add-on mods instead. Of course those will possibly be slower, and they are range limited to around the player at the normal-ish reach distance, compared to the loaded chunks range of "pasting".
But if you want "full survival pasting" while consuming the items, then you need a bunch of new code to handle it all. And the annoying part of that is dealing with all the special cases of what items should be consumed to place a given block. Plus in multiplayer this would need a server-side mod to handle this all. First of all it would need to be configurable, as most servers don't want anything like this, then you would need a good way to "paste" the block on the server to the correct state (that's simple to do in a server side mod ofc), and then you need a way to consume the correct item from the player.
If you want to work on this for yourself, then I think the pasting starts from the hotkey callbacks -> SchematicPlacementManager
-> one of the scheduled pasting tasks in scheduler/tasks/
. And there are some related item util methods in InventoryUtils
and MaterialCache
. But note that you shouldn't work on this if your intention is to get it to the official mod, as I'm unlikely to want to add this to the base mod. It could be another add-on mod though. The current Litematica code base just isn't really prepared for add-ons, so you need lots of Mixin hacks for that. Things should improve considerably for add-on mods after the mod rewrites progress further at some point.