3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-11-17 05:40:06 +01:00

Fix disconnect when encoding empty ItemStack

Dieser Commit ist enthalten in:
Moulberry 2024-06-27 03:17:09 +08:00
Ursprung c77e1417b1
Commit 4fa8228f34

Datei anzeigen

@ -29,7 +29,7 @@ public class ItemStackDataType implements PersistentDataType<PersistentDataConta
public @NotNull PersistentDataContainer toPrimitive(@NotNull ItemStack complex, @NotNull PersistentDataAdapterContext context) {
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(complex);
if (nmsStack == null) nmsStack = net.minecraft.world.item.ItemStack.EMPTY;
CompoundTag tag = (CompoundTag) nmsStack.save(MinecraftServer.getServer().registryAccess());
CompoundTag tag = (CompoundTag) nmsStack.saveOptional(MinecraftServer.getServer().registryAccess());
PersistentDataContainer container = context.newPersistentDataContainer();
((CraftPersistentDataContainer)container).putAll(tag);