diff options
author | Boy0000 <[email protected]> | 2024-06-21 19:01:10 +0200 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-11-18 14:50:38 -0500 |
commit | c92fa203dc2a438a028ea423598b0a338f4626d3 (patch) | |
tree | 3fa01b9a06b993223fa773321498500193d51e02 | |
parent | 501b7408780d5bb01100224d31427e9215d79d36 (diff) | |
download | Paper-c92fa203dc2a438a028ea423598b0a338f4626d3.tar.gz Paper-c92fa203dc2a438a028ea423598b0a338f4626d3.zip |
Various minor fixes for DataComponent-API (#10938)
* fix RECIPES not using kyori key
* add missing MapDecorations getter
* fix ComponentAdapter for MAP_POST_PROCESSING
-rw-r--r-- | patches/api/0480-WIP-DataComponent-API.patch | 11 | ||||
-rw-r--r-- | patches/server/1026-WIP-DataComponent-API.patch | 18 |
2 files changed, 21 insertions, 8 deletions
diff --git a/patches/api/0480-WIP-DataComponent-API.patch b/patches/api/0480-WIP-DataComponent-API.patch index 3501e19350..b651650697 100644 --- a/patches/api/0480-WIP-DataComponent-API.patch +++ b/patches/api/0480-WIP-DataComponent-API.patch @@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..50d15b4e0ed5cd17fdc95476ee4650ef +} diff --git a/src/main/java/io/papermc/paper/component/DataComponentTypes.java b/src/main/java/io/papermc/paper/component/DataComponentTypes.java new file mode 100644 -index 0000000000000000000000000000000000000000..fad96b6f92afc963eea51b49d3663349c867687d +index 0000000000000000000000000000000000000000..0d64edd242cd4a77cc1b6b8989544aad6641b5f5 --- /dev/null +++ b/src/main/java/io/papermc/paper/component/DataComponentTypes.java @@ -0,0 +1,313 @@ @@ -175,6 +175,7 @@ index 0000000000000000000000000000000000000000..fad96b6f92afc963eea51b49d3663349 +import io.papermc.paper.component.item.Unbreakable; +import io.papermc.paper.component.item.WritableBookContent; +import io.papermc.paper.component.item.WrittenBookContent; ++import net.kyori.adventure.key.Key; +import net.kyori.adventure.text.Component; +import org.bukkit.DyeColor; +import org.bukkit.FireworkEffect; @@ -185,7 +186,6 @@ index 0000000000000000000000000000000000000000..fad96b6f92afc963eea51b49d3663349 +import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.index.qual.Positive; +import org.checkerframework.common.value.qual.IntRange; -+import java.security.Key; +import java.util.List; + +import static java.util.Objects.requireNonNull; @@ -1509,10 +1509,10 @@ index 0000000000000000000000000000000000000000..316e3e0894c0d5cc0a7b304a815803f9 +} diff --git a/src/main/java/io/papermc/paper/component/item/MapDecorations.java b/src/main/java/io/papermc/paper/component/item/MapDecorations.java new file mode 100644 -index 0000000000000000000000000000000000000000..723f65d502a94617174203da02fda55f78621e2a +index 0000000000000000000000000000000000000000..589be7348bfef06fe628696d56748a9d44fca177 --- /dev/null +++ b/src/main/java/io/papermc/paper/component/item/MapDecorations.java -@@ -0,0 +1,95 @@ +@@ -0,0 +1,98 @@ +package io.papermc.paper.component.item; + +import io.papermc.paper.component.ComponentBuilder; @@ -1547,6 +1547,9 @@ index 0000000000000000000000000000000000000000..723f65d502a94617174203da02fda55f + @Contract(pure = true) + @Nullable DecorationEntry getDecoration(@NonNull String id); + ++ @Contract(pure = true) ++ Map<String, DecorationEntry> getDecorations(); ++ + /** + * Decoration present on the map. + */ diff --git a/patches/server/1026-WIP-DataComponent-API.patch b/patches/server/1026-WIP-DataComponent-API.patch index 0e6bd69eab..21dfe4207b 100644 --- a/patches/server/1026-WIP-DataComponent-API.patch +++ b/patches/server/1026-WIP-DataComponent-API.patch @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..e538819c873a324c58bcd8e73f89510e +} diff --git a/src/main/java/io/papermc/paper/component/ComponentAdapters.java b/src/main/java/io/papermc/paper/component/ComponentAdapters.java new file mode 100644 -index 0000000000000000000000000000000000000000..d5b1ef91d777cd207e51b4541cd0d7c7167c7be5 +index 0000000000000000000000000000000000000000..b01c5169e5677ff5b18e2e90be4f2018ad5928cc --- /dev/null +++ b/src/main/java/io/papermc/paper/component/ComponentAdapters.java @@ -0,0 +1,185 @@ @@ -153,7 +153,7 @@ index 0000000000000000000000000000000000000000..d5b1ef91d777cd207e51b4541cd0d7c7 + register(DataComponents.MAP_COLOR, PaperMapItemColor::new); + register(DataComponents.MAP_ID, PaperMapID::new); + register(DataComponents.MAP_DECORATIONS, PaperMapDecorations::new); -+ register(DataComponents.MAP_POST_PROCESSING, nms -> MapPostProcessing.valueOf(nms.name()), api -> MapPostProcessing.valueOf(api.name())); ++ register(DataComponents.MAP_POST_PROCESSING, nms -> io.papermc.paper.component.item.MapPostProcessing.valueOf(nms.name()), api -> MapPostProcessing.valueOf(api.name())); + register(DataComponents.CHARGED_PROJECTILES, PaperChargedProjectiles::new); + register(DataComponents.BUNDLE_CONTENTS, PaperBundleContents::new); + register(DataComponents.POTION_CONTENTS, PaperPotionContents::new); @@ -1979,10 +1979,10 @@ index 0000000000000000000000000000000000000000..5611a001165a32f39a26ce171142420e +} diff --git a/src/main/java/io/papermc/paper/component/item/PaperMapDecorations.java b/src/main/java/io/papermc/paper/component/item/PaperMapDecorations.java new file mode 100644 -index 0000000000000000000000000000000000000000..308a7c77522f501f750754c5228a98c088c37f19 +index 0000000000000000000000000000000000000000..99193e35b31259687d350e29c968c8a58397b8e4 --- /dev/null +++ b/src/main/java/io/papermc/paper/component/item/PaperMapDecorations.java -@@ -0,0 +1,80 @@ +@@ -0,0 +1,90 @@ +package io.papermc.paper.component.item; + +import java.util.HashMap; @@ -2014,6 +2014,16 @@ index 0000000000000000000000000000000000000000..308a7c77522f501f750754c5228a98c0 + return new PaperDecorationEntry(decoration); + } + ++ @Override ++ public Map<String, DecorationEntry> getDecorations() { ++ Map<String, DecorationEntry> decorations = new HashMap<>(); ++ for (Map.Entry<String, net.minecraft.world.item.component.MapDecorations.Entry> entry : this.impl.decorations().entrySet()) { ++ decorations.put(entry.getKey(), new PaperDecorationEntry(entry.getValue())); ++ } ++ ++ return decorations; ++ } ++ + public record PaperDecorationEntry(net.minecraft.world.item.component.MapDecorations.Entry entry) implements DecorationEntry { + + public static DecorationEntry toApi(final MapCursor.Type type, final double x, final double z, final float rotation) { |