diff options
author | Bjarne Koll <[email protected]> | 2024-11-14 20:56:00 +0100 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-11-18 14:50:38 -0500 |
commit | bc985c1b878491711439836f269d985cb45ddef0 (patch) | |
tree | 9e96e47aff5fce96ad069c719c49023f65f7ebaa | |
parent | 8122d5e053bb5de0ee97ff043dc26f2510508216 (diff) | |
download | Paper-bc985c1b878491711439836f269d985cb45ddef0.tar.gz Paper-bc985c1b878491711439836f269d985cb45ddef0.zip |
Add javadocs and text fixes
-rw-r--r-- | patches/api/0496-WIP-DataComponent-API.patch | 13 | ||||
-rw-r--r-- | patches/server/1065-WIP-DataComponent-API.patch | 73 | ||||
-rw-r--r-- | patches/server/1066-fix-test-drop-this-patch-on-rebase.patch | 24 |
3 files changed, 73 insertions, 37 deletions
diff --git a/patches/api/0496-WIP-DataComponent-API.patch b/patches/api/0496-WIP-DataComponent-API.patch index b6a8251300..476c9830c1 100644 --- a/patches/api/0496-WIP-DataComponent-API.patch +++ b/patches/api/0496-WIP-DataComponent-API.patch @@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..e2266d86a4dd1bf20346e48c428f8baf +} diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java new file mode 100644 -index 0000000000000000000000000000000000000000..e79800d626fdde02be88c75fa13d4793e7af1168 +index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cade0cdd627 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java -@@ -0,0 +1,345 @@ +@@ -0,0 +1,346 @@ +package io.papermc.paper.datacomponent; + +import io.papermc.paper.datacomponent.item.BannerPatternLayers; @@ -334,7 +334,8 @@ index 0000000000000000000000000000000000000000..e79800d626fdde02be88c75fa13d4793 + */ + public static final DataComponentType.NonValued INTANGIBLE_PROJECTILE = unvalued("intangible_projectile"); + /** -+ * When present, this item will behave as if a food (can be eaten). ++ * Controls potential food benefits gained when consuming the item the component is applied on. ++ * Requires the {@link #CONSUMABLE} component to allow consumption in the first place. + */ + public static final DataComponentType.Valued<FoodProperties> FOOD = valued("food"); + public static final DataComponentType.Valued<Consumable> CONSUMABLE = valued("consumable"); @@ -373,15 +374,15 @@ index 0000000000000000000000000000000000000000..e79800d626fdde02be88c75fa13d4793 + */ + public static final DataComponentType.Valued<DyedItemColor> DYED_COLOR = valued("dyed_color"); + /** -+ * Represents the tint of the decorations on the Filled Map item. ++ * Represents the tint of the decorations on the {@link org.bukkit.inventory.ItemType#FILLED_MAP} item. + */ + public static final DataComponentType.Valued<MapItemColor> MAP_COLOR = valued("map_color"); + /** -+ * References the shared map state holding map contents and markers for a Filled Map. ++ * References the shared map state holding map contents and markers for a {@link org.bukkit.inventory.ItemType#FILLED_MAP}. + */ + public static final DataComponentType.Valued<MapId> MAP_ID = valued("map_id"); + /** -+ * Holds a list of markers to be placed on a Filled Map (used for Explorer Maps). ++ * Holds a list of markers to be placed on a {@link org.bukkit.inventory.ItemType#FILLED_MAP} (used for Explorer Maps). + */ + public static final DataComponentType.Valued<MapDecorations> MAP_DECORATIONS = valued("map_decorations"); + /** diff --git a/patches/server/1065-WIP-DataComponent-API.patch b/patches/server/1065-WIP-DataComponent-API.patch index b9cbd2de5e..2048518902 100644 --- a/patches/server/1065-WIP-DataComponent-API.patch +++ b/patches/server/1065-WIP-DataComponent-API.patch @@ -4160,6 +4160,68 @@ index 0000000000000000000000000000000000000000..852ab097181491735fb9ee5ee4f70e4c +++ b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridge @@ -0,0 +1 @@ +io.papermc.paper.datacomponent.item.consumable.ConsumableTypesBridgeImpl +diff --git a/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java b/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e7aa11bcddc2d4f1747a6fe68b22c42d1b9f0e24 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/datacomponent/DataComponentTypesTest.java +@@ -0,0 +1,56 @@ ++package io.papermc.paper.datacomponent; ++ ++import com.google.common.collect.Collections2; ++import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; ++import net.minecraft.core.registries.Registries; ++import net.minecraft.resources.ResourceLocation; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.support.RegistryHelper; ++import org.bukkit.support.environment.AllFeatures; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Test; ++import java.lang.reflect.Field; ++import java.util.Set; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++ ++@AllFeatures ++public class DataComponentTypesTest { ++ ++ private static final Set<ResourceLocation> NOT_IN_API = Set.of( ++ ResourceLocation.parse("custom_data"), ++ ResourceLocation.parse("entity_data"), ++ ResourceLocation.parse("bees"), ++ ResourceLocation.parse("debug_stick_state"), ++ ResourceLocation.parse("block_entity_data"), ++ ResourceLocation.parse("bucket_entity_data") ++ ); ++ ++ @Test ++ public void testAllDataComponentsAreMapped() throws IllegalAccessException { ++ final Set<ResourceLocation> vanillaDataComponentTypes = new ObjectOpenHashSet<>( ++ RegistryHelper.getRegistry() ++ .lookupOrThrow(Registries.DATA_COMPONENT_TYPE) ++ .keySet() ++ ); ++ ++ for (final Field declaredField : DataComponentTypes.class.getDeclaredFields()) { ++ if (!DataComponentType.class.isAssignableFrom(declaredField.getType())) continue; ++ ++ final DataComponentType dataComponentType = (DataComponentType) declaredField.get(null); ++ if (!vanillaDataComponentTypes.remove(CraftNamespacedKey.toMinecraft(dataComponentType.getKey()))) { ++ Assertions.fail("API defined component type " + dataComponentType.key().asMinimalString() + " is unknown to vanilla registry"); ++ } ++ } ++ ++ if (!vanillaDataComponentTypes.containsAll(NOT_IN_API)) { ++ Assertions.fail("API defined data components that were marked as not-yet-implemented: " + NOT_IN_API.stream().filter(Predicate.not(vanillaDataComponentTypes::contains)).map(ResourceLocation::toString).collect(Collectors.joining(", "))); ++ } ++ ++ vanillaDataComponentTypes.removeAll(NOT_IN_API); ++ if (!vanillaDataComponentTypes.isEmpty()) { ++ Assertions.fail("API did not define following vanilla data component types: " + String.join(", ", Collections2.transform(vanillaDataComponentTypes, ResourceLocation::toString))); ++ } ++ } ++ ++} diff --git a/src/test/java/io/papermc/paper/item/ItemStackDataComponentEqualsTest.java b/src/test/java/io/papermc/paper/item/ItemStackDataComponentEqualsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6a287dcd4b42fa494117ae3f07def596c69d29da @@ -4262,10 +4324,10 @@ index 0000000000000000000000000000000000000000..6a287dcd4b42fa494117ae3f07def596 +} 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..9b0dfd087937b761038b58437e13ce967976164a +index 0000000000000000000000000000000000000000..220bf2bb666255d7a69e0035ff996474403b7907 --- /dev/null +++ b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java -@@ -0,0 +1,374 @@ +@@ -0,0 +1,371 @@ +package io.papermc.paper.item; + +import io.papermc.paper.datacomponent.DataComponentType; @@ -4430,10 +4492,10 @@ index 0000000000000000000000000000000000000000..9b0dfd087937b761038b58437e13ce96 + void testItemAttributes() { + final ItemStack stack = new ItemStack(Material.STONE); + AttributeModifier modifier = new AttributeModifier(NamespacedKey.minecraft("test"), 5, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.ANY); -+ stack.setData(DataComponentTypes.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.itemAttributes().showInTooltip(false).addModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifier).build()); ++ stack.setData(DataComponentTypes.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.itemAttributes().showInTooltip(false).addModifier(Attribute.ATTACK_DAMAGE, modifier).build()); + + Assertions.assertTrue(stack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ATTRIBUTES)); -+ Assertions.assertEquals(modifier, ((List<AttributeModifier>) stack.getItemMeta().getAttributeModifiers(Attribute.GENERIC_ATTACK_DAMAGE)).getFirst()); ++ Assertions.assertEquals(modifier, ((List<AttributeModifier>) stack.getItemMeta().getAttributeModifiers(Attribute.ATTACK_DAMAGE)).getFirst()); + stack.unsetData(DataComponentTypes.ATTRIBUTE_MODIFIERS); + Assertions.assertNull(stack.getItemMeta().getAttributeModifiers()); + } @@ -4470,7 +4532,6 @@ index 0000000000000000000000000000000000000000..9b0dfd087937b761038b58437e13ce96 + Assertions.assertFalse(meta.hasFood()); + } + -+ + @Test + void testTool() { + Tool properties = Tool.tool() @@ -4527,8 +4588,6 @@ index 0000000000000000000000000000000000000000..9b0dfd087937b761038b58437e13ce96 + Assertions.assertFalse(meta.hasJukeboxPlayable()); + } + -+ -+ + @Test + void testDyedColor() { + final ItemStack stack = new ItemStack(Material.LEATHER_CHESTPLATE); diff --git a/patches/server/1066-fix-test-drop-this-patch-on-rebase.patch b/patches/server/1066-fix-test-drop-this-patch-on-rebase.patch deleted file mode 100644 index a8ae5da5fd..0000000000 --- a/patches/server/1066-fix-test-drop-this-patch-on-rebase.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <[email protected]> -Date: Fri, 8 Nov 2024 21:51:54 +0100 -Subject: [PATCH] fix test (drop this patch on rebase) - - -diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java -index 75ed5050f72c001d6eab117a2c0b352a413548bd..cf9e00d7afc17cca4fb256a52ad11b767814149d 100644 ---- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java -+++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java -@@ -21,11 +21,13 @@ import org.bukkit.support.RegistryHelper; - import org.bukkit.support.environment.VanillaFeature; - import org.junit.jupiter.api.AfterAll; - import org.junit.jupiter.api.BeforeAll; -+import org.junit.jupiter.api.Disabled; - import org.junit.jupiter.api.Test; - - import static org.junit.jupiter.api.Assertions.assertTrue; - - @VanillaFeature -+@Disabled - public class MinecraftCommandPermissionsTest { - - private static PrintStream old; |