Skip to content

Commit

Permalink
Fix item stack serializer registry
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueZeeKing committed Jun 20, 2024
1 parent 78f5d5f commit bdd67b0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.icker.factions.api.persistents.User.ChatMode;
import io.icker.factions.api.persistents.User.Rank;
import io.icker.factions.api.persistents.User.SoundMode;
import io.icker.factions.util.WorldUtils;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtByte;
Expand All @@ -25,7 +26,6 @@
import net.minecraft.nbt.NbtLongArray;
import net.minecraft.nbt.NbtShort;
import net.minecraft.nbt.NbtString;
import net.minecraft.registry.DynamicRegistryManager;

public class SerializerRegistry {
private static final HashMap<Class<?>, Serializer<?, ? extends NbtElement>> registry =
Expand Down Expand Up @@ -121,7 +121,7 @@ private static Serializer<SimpleInventory, NbtList> createInventorySerializer(in
if (!itemStack.isEmpty()) {
NbtCompound nbtCompound = new NbtCompound();
nbtCompound.putByte("Slot", (byte) i);
nbtCompound.put("Data", itemStack.encode(DynamicRegistryManager.EMPTY));
nbtCompound.put("Data", itemStack.encode(WorldUtils.server.getRegistryManager()));
nbtList.add(nbtCompound);
}
}
Expand All @@ -138,7 +138,7 @@ private static Serializer<SimpleInventory, NbtList> createInventorySerializer(in
NbtCompound nbtCompound = el.getCompound(i);
int slot = nbtCompound.getByte("Slot") & 255;
if (slot >= 0 && slot < size) {
inventory.setStack(slot, ItemStack.fromNbt(DynamicRegistryManager.EMPTY, nbtCompound.get("Data")).get());
inventory.setStack(slot, ItemStack.fromNbt(WorldUtils.server.getRegistryManager(), nbtCompound.get("Data")).get());
}
}

Expand Down

0 comments on commit bdd67b0

Please sign in to comment.