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:
Ursprung
c77e1417b1
Commit
4fa8228f34
@ -29,7 +29,7 @@ public class ItemStackDataType implements PersistentDataType<PersistentDataConta
|
|||||||
public @NotNull PersistentDataContainer toPrimitive(@NotNull ItemStack complex, @NotNull PersistentDataAdapterContext context) {
|
public @NotNull PersistentDataContainer toPrimitive(@NotNull ItemStack complex, @NotNull PersistentDataAdapterContext context) {
|
||||||
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(complex);
|
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(complex);
|
||||||
if (nmsStack == null) nmsStack = net.minecraft.world.item.ItemStack.EMPTY;
|
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();
|
PersistentDataContainer container = context.newPersistentDataContainer();
|
||||||
((CraftPersistentDataContainer)container).putAll(tag);
|
((CraftPersistentDataContainer)container).putAll(tag);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren