General ItemMeta fixes

== AT ==
private-f net/minecraft/world/item/ItemStack components
public net/minecraft/world/food/FoodProperties DEFAULT_EAT_SECONDS
public org/bukkit/craftbukkit/block/CraftBlockStates getBlockState(Lorg/bukkit/World;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)Lorg/bukkit/craftbukkit/block/CraftBlockState;
public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V

Co-authored-by: GhastCraftHD <julius.gruenberg@leghast.de>
This commit is contained in:
Jake Potrebic
2024-04-27 20:56:17 -07:00
parent 445e9a65fb
commit 31725bc039
30 changed files with 582 additions and 339 deletions

View File

@@ -151,6 +151,19 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
return this.snapshot.getUpdateTag(this.getRegistryAccess());
}
// Paper start - properly save blockentity itemstacks
public CompoundTag getSnapshotCustomNbtOnly() {
this.applyTo(this.snapshot);
final CompoundTag nbt = this.snapshot.saveCustomOnly(this.getRegistryAccess());
this.snapshot.removeComponentsFromTag(nbt);
if (!nbt.isEmpty()) {
// have to include the "id" if it's going to have block entity data
this.snapshot.saveId(nbt);
}
return nbt;
}
// Paper end
// copies the data of the given tile entity to this block state
protected void load(T tileEntity) {
if (tileEntity != null && tileEntity != this.snapshot) {