Litematica

Litematica

8M Downloads

Save/place items inside tile entities

Andrews54757 opened this issue · 9 comments

commented

I work with a lot of complex redstone builds, and many utilize certain mechanics concerning the items inside tile entities. For example, furnaces and chests can be used to control signal output via comparators. In such case, the items inside and their exact amounts matter.

It would be great if litematica could save the items inside these tile entities, and auto-fill them when pasting/placing. In creative, this would not be too difficult, as blocks with custom nbt data could be directly created.

commented

Without a server-side mod the main issue is trying to apply the NBT data to entities or block entities via commands, because the vanilla chat packets are limited to 256 characters, which basically prevents setting the full NBT data in one command, it would have to be divided to countless /data merge commands or something.

@maruohon Say I have something to bypass the 256 character limit (such as InfiniChat for Wurst), would you be able to provide an option for those users with the bypass?

commented

also yes its a thing, also your way of doing it is cool.

commented

Ehhhhhhhh it’s just eventually going to be server side with survux also it should not break stuff with survux cause it’s Oates deeper I. The code.

commented

@itsmeboy0 Even if you have Wurst on the client, it does nothing to bypass the server only reading the first 256 characters of the chat message packet. I think the feature they advertise is probably for single player only(?)

commented

Oh, but this is an old issue report... so this actually already exists for block entities. There is a new option pasteNbtRestoreBehavior in the Generic configs in some of the later mod versions. You can set that to Data Modify or whatever it was called, while you paste things that need the block entity data.

I would recommend keeping it disabled while you don't actually need to restore the data, as it will add overhead to the paste operations, since it will temporarily place the block to the client world, pick block it, send a creative inventory sync packet to get that NBT data to the server, then temporarily place the NBT-pick-blocked item on the server, then use the data modify command to clone the data from it to the actual target block, and then setblock it to air again... or something like that. I kinda forgot the details by now.

commented

lol,
image
the code, Ima see mixins too, here
image
it seems to set client chat length, @maruohon you said it was server handled, If this works then, also Def a client mixin

commented

It can get saved if it is in singleplayer, but in multiplayer this is not possible without a server side mod

commented

Yep in single player the Paste mode should directly replicate the original schematic, which in turn should be an exact copy of the original build if it was saved in single player, where the mod can look at the integrated server's world to get all the TileEntity and Entity NBT data and scheduled TileTicks.

I have a server-side companion mod slowly in the works, which is planned to also have integration with Litematica, and the goal is to get single player-like saving and pasting also on servers, plus the Block Info overlay showing the inventory contents also on servers etc.

Without a server-side mod the main issue is trying to apply the NBT data to entities or block entities via commands, because the vanilla chat packets are limited to 256 characters, which basically prevents setting the full NBT data in one command, it would have to be divided to countless /data merge commands or something. For saving there is a vanilla packet in 1.13+ that could request the NBT data if the user is OP'd on the server, but I haven't hooked that up at least yet, because I have that proper server-side mod in the works anyway.

commented

@maruohon I was thinking more along the lines of "nbt pick blocking" based on the Creative Inventory Action Protocol. (to clarify, this is not involved with the schematic paste operation)

Also, I believe it is possible for multiplayer without any server-side mods. Perhaps by using the Query Block NBT/Query Entity NBT Protocols? (EDIT: Seems to only work with OP, would have to use other protocol, perhaps GUI)