From a3f92e809c21c9a618c16c7e3b46bc4cace92658 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:56:34 -0400 Subject: Update --- patches/server/1026-WIP-DataComponent-API.patch | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/patches/server/1026-WIP-DataComponent-API.patch b/patches/server/1026-WIP-DataComponent-API.patch index d1fccc8973..0e6bd69eab 100644 --- a/patches/server/1026-WIP-DataComponent-API.patch +++ b/patches/server/1026-WIP-DataComponent-API.patch @@ -3204,10 +3204,10 @@ index 0000000000000000000000000000000000000000..a2c02206254a18e089cb2b40eab5c59e +io.papermc.paper.component.item.ComponentTypesBridgesImpl diff --git a/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..f53fb0732aa3a90ebc75dc786cc61d0037fa5648 +index 0000000000000000000000000000000000000000..cb52cc252934561e7b47fbd4a26d10013e9e7e77 --- /dev/null +++ b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java -@@ -0,0 +1,391 @@ +@@ -0,0 +1,403 @@ +package io.papermc.paper.item; + +import ca.spottedleaf.concurrentutil.util.CollectionUtil; @@ -3564,7 +3564,8 @@ index 0000000000000000000000000000000000000000..f53fb0732aa3a90ebc75dc786cc61d00 + } + + @SuppressWarnings("unchecked") -+ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ ItemStack original = stack.clone(); + stack.setData(type, value); + + Assertions.assertEquals(value, stack.getData(type)); @@ -3573,10 +3574,16 @@ index 0000000000000000000000000000000000000000..f53fb0732aa3a90ebc75dc786cc61d00 + final M typedMeta = Assertions.assertInstanceOf(metaType, meta); + + Assertions.assertEquals(metaGetter.apply(typedMeta), value); ++ ++ // SETTING ++ metaSetter.accept(typedMeta, value); ++ original.setItemMeta(typedMeta); ++ Assertions.assertEquals(value, original.getData(type)); + } + + @SuppressWarnings("unchecked") -+ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, Function mapper, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ private static void testWithMeta(final ItemStack stack, final DataComponentType.Valued type, final T value, Function mapper, final Class metaType, final Function metaGetter, final BiConsumer metaSetter) { ++ ItemStack original = stack.clone(); + stack.setData(type, value); + + Assertions.assertEquals(value, stack.getData(type)); @@ -3585,6 +3592,11 @@ index 0000000000000000000000000000000000000000..f53fb0732aa3a90ebc75dc786cc61d00 + final M typedMeta = Assertions.assertInstanceOf(metaType, meta); + + Assertions.assertEquals(metaGetter.apply(typedMeta), mapper.apply(value)); ++ ++ // SETTING ++ metaSetter.accept(typedMeta, mapper.apply(value)); ++ original.setItemMeta(typedMeta); ++ Assertions.assertEquals(value, original.getData(type)); + } + + @SuppressWarnings("unchecked") -- cgit v1.2.3