diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-06-13 21:46:56 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-06-18 16:34:37 -0400 |
commit | 3a53e51494523871870491617ae6add9b3fe87fe (patch) | |
tree | 2ad7c2e1718b3441f33d09e1be19c4051b0a1b44 /src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java | |
parent | 265c09b16b78b93a55745ce8dd008d405e735d6b (diff) | |
download | Skyblocker-3a53e51494523871870491617ae6add9b3fe87fe.tar.gz Skyblocker-3a53e51494523871870491617ae6add9b3fe87fe.tar.bz2 Skyblocker-3a53e51494523871870491617ae6add9b3fe87fe.zip |
1.21
Diffstat (limited to 'src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java')
-rw-r--r-- | src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java b/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java index d791fd72..a151ae2f 100644 --- a/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java +++ b/src/test/java/de/hysky/skyblocker/utils/datafixer/ItemStackComponentizationFixerTest.java @@ -17,15 +17,19 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.StringNbtReader; +import net.minecraft.registry.BuiltinRegistries; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryWrapper.WrapperLookup; import net.minecraft.util.Util; public class ItemStackComponentizationFixerTest { + /*private final WrapperLookup LOOKUP = BuiltinRegistries.createWrapperLookup(); private final NbtCompound NBT = convertToNbt("{id:\"minecraft:diamond_sword\",Count:1,tag:{ExtraAttributes:{id:\"TEST\"}}}"); private final Gson GSON = new Gson(); private final ItemStack TEST_STACK = Util.make(new ItemStack(Items.DIAMOND_SWORD, 1), item -> { ItemEnchantmentsComponent.Builder builder = new ItemEnchantmentsComponent.Builder(ItemEnchantmentsComponent.DEFAULT); - builder.add(Enchantments.SHARPNESS, 1); + builder.add(LOOKUP.getWrapperOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(Enchantments.SHARPNESS), 1); item.set(DataComponentTypes.ENCHANTMENTS, builder.build()); }); @@ -43,7 +47,7 @@ public class ItemStackComponentizationFixerTest { @Test void testDataFixer() { ItemStack fixedStack = ItemStackComponentizationFixer.fixUpItem(NBT); - JsonElement stackJson = ItemStack.CODEC.encodeStart(JsonOps.INSTANCE, fixedStack).getOrThrow(); + JsonElement stackJson = ItemStack.CODEC.encodeStart(LOOKUP.getOps(JsonOps.INSTANCE), fixedStack).getOrThrow(); Assertions.assertEquals("{\"id\":\"minecraft:diamond_sword\",\"count\":1,\"components\":{\"minecraft:custom_data\":{\"ExtraAttributes\":{\"id\":\"TEST\"}}}}", GSON.toJson(stackJson)); } @@ -85,5 +89,5 @@ public class ItemStackComponentizationFixerTest { } catch (Exception e) { return new NbtCompound(); } - } + }*/ } |