SPIGOT-7881: CTRL+Pick Block saves position data into item

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-09-15 17:17:10 +10:00
parent 4b1526b609
commit 5f1cd5748b
2 changed files with 57 additions and 8 deletions

View File

@@ -109,12 +109,20 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
return snapshot.saveWithFullMetadata(getRegistryAccess());
}
public NBTTagCompound getSnapshotNBTWithoutComponents() {
NBTTagCompound nbt = getSnapshotNBT();
public NBTTagCompound getItemNBT() {
// update snapshot
applyTo(snapshot);
// See TileEntity#saveToItem
NBTTagCompound nbt = snapshot.saveCustomOnly(getRegistryAccess());
snapshot.removeComponentsFromTag(nbt);
return nbt;
}
public void addEntityType(NBTTagCompound nbt) {
TileEntity.addEntityType(nbt, snapshot.getType());
}
// gets the packet data of the TileEntity represented by this block state
public NBTTagCompound getUpdateNBT() {
// update snapshot