Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-09 01:50:05 +01:00
Fix disconnect when encoding empty ItemStack
Dieser Commit ist enthalten in:
Ursprung
73e81de300
Commit
cc4e729728
@ -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