mirror of https://github.com/PaperMC/Paper.git
general work & cleanup
This commit is contained in:
parent
c3f2c3c8d9
commit
8ae4528411
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..684400c5de46d79ef7506f7c8240e57b
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/DataComponentTypes.java b/src/main/java/io/papermc/paper/datakey/DataComponentTypes.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4de1798de09061780f4d0d2809383b0b954ab03a
|
||||
index 0000000000000000000000000000000000000000..978d4d3d28c3563d15f7566004103a898af19278
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/DataComponentTypes.java
|
||||
@@ -0,0 +1,77 @@
|
||||
|
@ -102,60 +102,67 @@ index 0000000000000000000000000000000000000000..4de1798de09061780f4d0d2809383b0b
|
|||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ private static DataComponentType.NonValued nonTyped(String name) {
|
||||
+ return (DataComponentType.NonValued) Registry.DATA_COMPONENT_TYPES.get(NamespacedKey.minecraft(name));
|
||||
+ return (DataComponentType.NonValued) Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name));
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ private static <T> DataComponentType.Valued<T> typed(String name) {
|
||||
+ return (DataComponentType.Valued<T>) Registry.DATA_COMPONENT_TYPES.get(NamespacedKey.minecraft(name));
|
||||
+ return (DataComponentType.Valued<T>) Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/DataComponentMap.java b/src/main/java/io/papermc/paper/datakey/map/DataComponentMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fd59c41b20cb5f2679e91195e53d13521d8c34cb
|
||||
index 0000000000000000000000000000000000000000..5ca7314eef78bb74b8da5c830d6eb63e14af3a02
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/DataComponentMap.java
|
||||
@@ -0,0 +1,25 @@
|
||||
@@ -0,0 +1,31 @@
|
||||
+package io.papermc.paper.datakey.map;
|
||||
+
|
||||
+import io.papermc.paper.datakey.DataComponentType;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+public interface DataComponentMap {
|
||||
+
|
||||
+ static DataComponentMap empty() {
|
||||
+ return DataKeyMapBridge.Holder.BRIDGE.empty();
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static @NotNull DataComponentMap empty() {
|
||||
+ return DataComponentPatchMapBridge.Holder.bridge().empty();
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ <T> T get(DataComponentType.Valued<T> type);
|
||||
+ @Contract(pure = true)
|
||||
+ <T> @Nullable T get(DataComponentType.Valued<T> type);
|
||||
+
|
||||
+ Set<DataComponentType> keySet();
|
||||
+ @Contract(pure = true)
|
||||
+ @Nullable Set<DataComponentType> keySet();
|
||||
+
|
||||
+ boolean has(DataComponentType type);
|
||||
+ @Contract(pure = true)
|
||||
+ boolean has(@NotNull DataComponentType type);
|
||||
+
|
||||
+ default <T> T getOrDefault(DataComponentType.Valued<T> type, T fallback) {
|
||||
+ T object = this.get(type);
|
||||
+ @Contract(value = "_, !null -> !null", pure = true)
|
||||
+ default <T> @Nullable T getOrDefault(final DataComponentType.@Nullable Valued<? extends T> type, final @Nullable T fallback) {
|
||||
+ final T object = this.get(type);
|
||||
+ return object != null ? object : fallback;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/DataKeyMapBridge.java b/src/main/java/io/papermc/paper/datakey/map/DataKeyMapBridge.java
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/DataComponentPatchMapBridge.java b/src/main/java/io/papermc/paper/datakey/map/DataComponentPatchMapBridge.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1ecbdd8f455478c3566880fe2e1896af6b9f78c5
|
||||
index 0000000000000000000000000000000000000000..e0d825400f459a1aea44a7717286df7410bbbc0c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/DataKeyMapBridge.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/DataComponentPatchMapBridge.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package io.papermc.paper.datakey.map;
|
||||
+
|
||||
+import java.util.Optional;
|
||||
+import net.kyori.adventure.util.Services;
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.inventory.meta.ItemMeta;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+public interface DataKeyMapBridge {
|
||||
+public interface DataComponentPatchMapBridge {
|
||||
+
|
||||
+ PatchedDataComponentMap of(DataComponentMap keyMap);
|
||||
+
|
||||
|
@ -168,15 +175,17 @@ index 0000000000000000000000000000000000000000..1ecbdd8f455478c3566880fe2e1896af
|
|||
+ ItemMeta toItemMeta(Material material, PatchedDataComponentMap dataKeyMap);
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ class Holder {
|
||||
+ final class Holder {
|
||||
+ private static final Optional<DataComponentPatchMapBridge> BRIDGE = Services.service(DataComponentPatchMapBridge.class);
|
||||
+
|
||||
+ public static DataKeyMapBridge BRIDGE = Services.service(DataKeyMapBridge.class)
|
||||
+ .orElseThrow();
|
||||
+ public static DataComponentPatchMapBridge bridge() {
|
||||
+ return BRIDGE.orElseThrow();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMap.java b/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..616f0cbf465adf9eff2daca1080c4a704797c90f
|
||||
index 0000000000000000000000000000000000000000..adc0fc866fe04063c1f4a6c0bb98e416f14f8d06
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMap.java
|
||||
@@ -0,0 +1,57 @@
|
||||
|
@ -190,11 +199,11 @@ index 0000000000000000000000000000000000000000..616f0cbf465adf9eff2daca1080c4a70
|
|||
+public interface PatchedDataComponentMap extends DataComponentMap {
|
||||
+
|
||||
+ static PatchedDataComponentMap empty() {
|
||||
+ return DataKeyMapBridge.Holder.BRIDGE.of(DataKeyMapBridge.Holder.BRIDGE.empty());
|
||||
+ return DataComponentPatchMapBridge.Holder.bridge().of(DataComponentPatchMapBridge.Holder.bridge().empty());
|
||||
+ }
|
||||
+
|
||||
+ static PatchedDataComponentMap of(DataComponentMap map) {
|
||||
+ return DataKeyMapBridge.Holder.BRIDGE.of(map);
|
||||
+ return DataComponentPatchMapBridge.Holder.bridge().of(map);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -237,12 +246,12 @@ index 0000000000000000000000000000000000000000..616f0cbf465adf9eff2daca1080c4a70
|
|||
+
|
||||
+ PatchedDataComponentMap copy();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/PatchedDataKeyMapHolder.java b/src/main/java/io/papermc/paper/datakey/map/PatchedDataKeyMapHolder.java
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMapHolder.java b/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMapHolder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..35c931516f168d57e9ad667ac6ad57a0ffbcd1d5
|
||||
index 0000000000000000000000000000000000000000..57c8452de74e33cdd0f234c08b3b769a1c0c70a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/PatchedDataKeyMapHolder.java
|
||||
@@ -0,0 +1,31 @@
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/map/PatchedDataComponentMapHolder.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package io.papermc.paper.datakey.map;
|
||||
+
|
||||
+import io.papermc.paper.datakey.DataComponentType;
|
||||
|
@ -252,10 +261,9 @@ index 0000000000000000000000000000000000000000..35c931516f168d57e9ad667ac6ad57a0
|
|||
+
|
||||
+@ApiStatus.NonExtendable
|
||||
+@ApiStatus.Experimental
|
||||
+public interface PatchedDataKeyMapHolder {
|
||||
+public interface PatchedDataComponentMapHolder {
|
||||
+
|
||||
+ @NotNull
|
||||
+ PatchedDataComponentMap components();
|
||||
+ @NotNull PatchedDataComponentMap components();
|
||||
+
|
||||
+ default <T> T getData(final DataComponentType.@NotNull Valued<T> dataKey) {
|
||||
+ return this.components().get(dataKey);
|
||||
|
@ -287,16 +295,15 @@ index 0000000000000000000000000000000000000000..325a597b8d3e0c574b7bc80b7c9d0dee
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridge.java b/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridge.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4e6e58c094c20f4b57b0274a17750262b628289d
|
||||
index 0000000000000000000000000000000000000000..60a49ecb5788de79d3a130fd0ddd7c4c56855553
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridge.java
|
||||
@@ -0,0 +1,19 @@
|
||||
@@ -0,0 +1,22 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import java.util.Optional;
|
||||
+import net.kyori.adventure.util.Services;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import java.util.List;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+public interface ComponentTypesBridge {
|
||||
|
@ -305,74 +312,100 @@ index 0000000000000000000000000000000000000000..4e6e58c094c20f4b57b0274a17750262
|
|||
+
|
||||
+ ItemLore.Builder lore();
|
||||
+
|
||||
+ public static class Holder {
|
||||
+ public static ComponentTypesBridge BRIDGE = Services.service(ComponentTypesBridge.class)
|
||||
+ .orElseThrow();
|
||||
+ @ApiStatus.Internal
|
||||
+ final class Holder {
|
||||
+ private static final Optional<ComponentTypesBridge> BRIDGE = Services.service(ComponentTypesBridge.class);
|
||||
+
|
||||
+ public static ComponentTypesBridge bridge() {
|
||||
+ return BRIDGE.orElseThrow();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/ItemLore.java b/src/main/java/io/papermc/paper/datakey/types/ItemLore.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d8845b14f26df980a97108290d40fb5cda4adb80
|
||||
index 0000000000000000000000000000000000000000..a395f5f3fbd9ffe4cb7fdfa4d60ace937b23bbb4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/ItemLore.java
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -0,0 +1,40 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.ComponentLike;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import java.util.List;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface ItemLore {
|
||||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemLore.Builder lore() {
|
||||
+ return ComponentTypesBridge.Holder.BRIDGE.lore();
|
||||
+ return ComponentTypesBridge.Holder.bridge().lore();
|
||||
+ }
|
||||
+
|
||||
+ List<Component> lines();
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static ItemLore lore(final List<? extends ComponentLike> lore) {
|
||||
+ return lore().lore(lore).build();
|
||||
+ }
|
||||
+
|
||||
+ List<Component> styledLines();
|
||||
+ @Contract(pure = true)
|
||||
+ @NotNull @Unmodifiable List<Component> lines();
|
||||
+
|
||||
+ @Contract(pure = true)
|
||||
+ @NotNull @Unmodifiable List<Component> styledLines();
|
||||
+
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Builder {
|
||||
+
|
||||
+ @Contract("_ -> this")
|
||||
+ Builder lore(List<Component> lore);
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ Builder lore(List<? extends ComponentLike> lore);
|
||||
+
|
||||
+ @NotNull
|
||||
+ ItemLore build();
|
||||
+ @Contract(pure = true, value = "-> new")
|
||||
+ @NotNull ItemLore build();
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/Unbreakable.java b/src/main/java/io/papermc/paper/datakey/types/Unbreakable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d76edc05c6bc2a1cdce1eeb4ce715d342528bd18
|
||||
index 0000000000000000000000000000000000000000..0fd13581402a288464ea6d5e1273600081f97cf3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/Unbreakable.java
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -0,0 +1,36 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface Unbreakable {
|
||||
+
|
||||
+ @NotNull
|
||||
+ static Unbreakable.Builder unbreakable() {
|
||||
+ return ComponentTypesBridge.Holder.BRIDGE.unbreakable();
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static Unbreakable.@NotNull Builder unbreakable() {
|
||||
+ return ComponentTypesBridge.Holder.bridge().unbreakable();
|
||||
+ }
|
||||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NotNull Unbreakable unbreakable(final boolean showInTooltip) {
|
||||
+ return unbreakable().showInTooltip(showInTooltip).build();
|
||||
+ }
|
||||
+
|
||||
+ @Contract(pure = true)
|
||||
+ boolean showInTooltip();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ Unbreakable showInTooltip(boolean showInTooltip);
|
||||
+
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Builder {
|
||||
+
|
||||
+ @Contract("_ -> this")
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ Builder showInTooltip(boolean showInTooltip);
|
||||
+
|
||||
+ @NotNull
|
||||
+ Unbreakable build();
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ @NotNull Unbreakable build();
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
|
@ -390,7 +423,7 @@ index 82d009c0bbe4b3026a535e02d6e0ed20c7bd525d..2e829272171761da93c8d44d3c04e23e
|
|||
GRANITE(21091),
|
||||
POLISHED_GRANITE(5477),
|
||||
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
||||
index 542c0516e19b6177ff8007ca6f8955dc9082da95..25157e0285a73e480b6b1a9195aad56c83c376ba 100644
|
||||
index 542c0516e19b6177ff8007ca6f8955dc9082da95..982342c10bc4e9e228d5281ffd0828707fcd6534 100644
|
||||
--- a/src/main/java/org/bukkit/Registry.java
|
||||
+++ b/src/main/java/org/bukkit/Registry.java
|
||||
@@ -317,6 +317,8 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
|
@ -398,7 +431,7 @@ index 542c0516e19b6177ff8007ca6f8955dc9082da95..25157e0285a73e480b6b1a9195aad56c
|
|||
}
|
||||
};
|
||||
+
|
||||
+ Registry<io.papermc.paper.datakey.DataComponentType> DATA_COMPONENT_TYPES = (Registry) Bukkit.getRegistry(io.papermc.paper.datakey.DataComponentType.class);
|
||||
+ Registry<io.papermc.paper.datakey.DataComponentType> DATA_COMPONENT_TYPE = Objects.requireNonNull(Bukkit.getRegistry(io.papermc.paper.datakey.DataComponentType.class), "No registry present for DataComponentType<?>. This is a bug.");
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
|
@ -415,15 +448,23 @@ index 98a970a6582dca22e719a31559c7becea4725cb2..84708afee2316108babbd64c9c667146
|
|||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f86d075da 100644
|
||||
index 84a7bf0936d35bf42b5ed038d295d5c31740f472..c0c6f7dace959b5726fd7000024725c5e7229ccc 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -25,11 +25,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
-import com.google.common.collect.ImmutableMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List; // Paper
|
||||
import java.util.Map;
|
||||
@@ -25,11 +24,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
* use this class to encapsulate Materials for which {@link Material#isItem()}
|
||||
* returns false.</b>
|
||||
*/
|
||||
-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper
|
||||
+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable, io.papermc.paper.datakey.map.PatchedDataKeyMapHolder { // Paper
|
||||
+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable, io.papermc.paper.datakey.map.PatchedDataComponentMapHolder { // Paper
|
||||
private Material type = Material.AIR;
|
||||
private int amount = 0;
|
||||
private MaterialData data = null;
|
||||
|
@ -432,19 +473,19 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
|
||||
@Utility
|
||||
protected ItemStack() {}
|
||||
@@ -86,6 +86,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -86,6 +85,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
Preconditions.checkArgument(type != null, "Material cannot be null");
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.of(io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.fromItem(type)); // Paper
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().of(io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().fromItem(type)); // Paper
|
||||
if (damage != 0) {
|
||||
setDurability(damage);
|
||||
}
|
||||
@@ -148,10 +149,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -148,10 +148,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@Deprecated // Paper
|
||||
public void setType(@NotNull Material type) {
|
||||
Preconditions.checkArgument(type != null, "Material cannot be null");
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.fromItemMeta(type, Bukkit.getItemFactory().asMetaFor(this.getItemMeta(), type)); // Paper - update type first too, we need the old context to resolve the meta from the type
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().fromItemMeta(type, Bukkit.getItemFactory().asMetaFor(this.getItemMeta(), type)); // Paper - update type first too, we need the old context to resolve the meta from the type
|
||||
this.type = type;
|
||||
- if (this.meta != null) {
|
||||
- this.meta = Bukkit.getItemFactory().asMetaFor(meta, type);
|
||||
|
@ -452,7 +493,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
if (type.isLegacy()) {
|
||||
createData((byte) 0);
|
||||
} else {
|
||||
@@ -275,6 +274,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -275,6 +273,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
*/
|
||||
@Utility
|
||||
public int getMaxStackSize() {
|
||||
|
@ -460,7 +501,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
if (meta != null && meta.hasMaxStackSize()) {
|
||||
return meta.getMaxStackSize();
|
||||
}
|
||||
@@ -335,9 +335,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -335,9 +334,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
try {
|
||||
ItemStack itemStack = (ItemStack) super.clone();
|
||||
|
||||
|
@ -471,7 +512,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
|
||||
if (this.data != null) {
|
||||
itemStack.data = this.data.clone();
|
||||
@@ -357,7 +355,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -357,7 +354,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
hash = hash * 31 + getType().hashCode();
|
||||
hash = hash * 31 + getAmount();
|
||||
hash = hash * 31 + (getDurability() & 0xffff);
|
||||
|
@ -480,7 +521,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
|
||||
return hash;
|
||||
}
|
||||
@@ -369,7 +367,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -369,7 +366,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
* @return True if this has the given enchantment
|
||||
*/
|
||||
public boolean containsEnchantment(@NotNull Enchantment ench) {
|
||||
|
@ -489,7 +530,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -379,7 +377,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -379,7 +376,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
* @return Level of the enchantment, or 0
|
||||
*/
|
||||
public int getEnchantmentLevel(@NotNull Enchantment ench) {
|
||||
|
@ -498,7 +539,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -389,7 +387,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -389,7 +386,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
*/
|
||||
@NotNull
|
||||
public Map<Enchantment, Integer> getEnchantments() {
|
||||
|
@ -507,7 +548,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -465,10 +463,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -465,10 +462,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
* @param level Level of the enchantment
|
||||
*/
|
||||
public void addUnsafeEnchantment(@NotNull Enchantment ench, int level) {
|
||||
|
@ -520,7 +561,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -480,10 +479,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -480,10 +478,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
*/
|
||||
public int removeEnchantment(@NotNull Enchantment ench) {
|
||||
int level = getEnchantmentLevel(ench);
|
||||
|
@ -533,7 +574,7 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
return level;
|
||||
}
|
||||
|
||||
@@ -491,11 +490,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -491,11 +489,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
* Removes all enchantments on this ItemStack.
|
||||
*/
|
||||
public void removeEnchantments() {
|
||||
|
@ -546,16 +587,16 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -647,7 +642,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -647,7 +641,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
*/
|
||||
@UndefinedNullability // Paper
|
||||
public ItemMeta getItemMeta() {
|
||||
- return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone();
|
||||
+ return io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.toItemMeta(this.type, this.components());
|
||||
+ return io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().toItemMeta(this.type, this.components());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -656,7 +651,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -656,7 +650,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
* @return Returns true if some meta data has been set for this item
|
||||
*/
|
||||
public boolean hasItemMeta() {
|
||||
|
@ -564,12 +605,12 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -677,22 +672,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -677,22 +671,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
*/
|
||||
private boolean setItemMeta0(@Nullable ItemMeta itemMeta, @NotNull Material material) {
|
||||
if (itemMeta == null) {
|
||||
- this.meta = null;
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.PatchedDataComponentMap.of(io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.fromItem(material));
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.PatchedDataComponentMap.of(io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().fromItem(material));
|
||||
return true;
|
||||
}
|
||||
if (!Bukkit.getItemFactory().isApplicable(itemMeta, material)) {
|
||||
|
@ -585,11 +626,11 @@ index 84a7bf0936d35bf42b5ed038d295d5c31740f472..e20cef9ad49e515da8947e6fd7658e5f
|
|||
- if (this.meta == itemMeta) {
|
||||
- this.meta = itemMeta.clone();
|
||||
- }
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataKeyMapBridge.Holder.BRIDGE.fromItemMeta(material, itemMeta);
|
||||
+ this.dataKeyMap = io.papermc.paper.datakey.map.DataComponentPatchMapBridge.Holder.bridge().fromItemMeta(material, itemMeta);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1073,4 +1059,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
@@ -1073,4 +1058,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player);
|
||||
}
|
||||
// Paper end - expose itemstack tooltip lines
|
||||
|
|
|
@ -4,82 +4,126 @@ Date: Sun, 28 Apr 2024 19:53:01 -0400
|
|||
Subject: [PATCH] WIP DataKey API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/ComponentAdapter.java b/src/main/java/io/papermc/paper/datakey/ComponentAdapter.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..acf512f3d6a8d6ffadff54341e3e2e57379226c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/ComponentAdapter.java
|
||||
@@ -0,0 +1,7 @@
|
||||
+package io.papermc.paper.datakey;
|
||||
+
|
||||
+import java.util.function.Function;
|
||||
+import net.minecraft.core.component.DataComponentType;
|
||||
+
|
||||
+public record ComponentAdapter<NMS, API>(DataComponentType<NMS> type, Function<API, NMS> nmsConverter, Function<NMS, API> apiConverter) {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/ComponentAdapters.java b/src/main/java/io/papermc/paper/datakey/ComponentAdapters.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..860e2a37e21df7f0c939d826ca9c0cce186a73e8
|
||||
index 0000000000000000000000000000000000000000..0d7fa2a3926fcedebc292c7bdd10aeac36234f72
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/ComponentAdapters.java
|
||||
@@ -0,0 +1,59 @@
|
||||
@@ -0,0 +1,91 @@
|
||||
+package io.papermc.paper.datakey;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import io.papermc.paper.datakey.types.ItemLore;
|
||||
+import io.papermc.paper.datakey.types.PaperItemLore;
|
||||
+import io.papermc.paper.datakey.types.PaperUnbreakable;
|
||||
+import io.papermc.paper.datakey.types.Unbreakable;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.core.component.DataComponents;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.util.Unit;
|
||||
+import net.minecraft.world.item.Rarity;
|
||||
+import org.bukkit.inventory.ItemRarity;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.function.Function;
|
||||
+import net.minecraft.core.component.DataComponentType;
|
||||
+import net.minecraft.core.component.DataComponents;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.util.Unit;
|
||||
+import net.minecraft.world.item.Rarity;
|
||||
+import org.bukkit.craftbukkit.util.Handleable;
|
||||
+import org.bukkit.inventory.ItemRarity;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+public class ComponentAdapters {
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class ComponentAdapters {
|
||||
+
|
||||
+ static final Map<ResourceLocation, ComponentAdapter<?, ?>> ADAPTERS = new HashMap<>();
|
||||
+ static final Map<ResourceKey<DataComponentType<?>>, ComponentAdapter<?, ?>> ADAPTERS = new HashMap<>();
|
||||
+
|
||||
+ public static void bootstrap() {
|
||||
+ registerIdentity(DataComponents.DAMAGE, Integer.class);
|
||||
+ registerIdentity(DataComponents.MAX_DAMAGE, Integer.class);
|
||||
+ registerIdentity(DataComponents.MAX_STACK_SIZE, Integer.class);
|
||||
+ register(DataComponents.UNBREAKABLE, DataComponentTypes.UNBREAKABLE, Unbreakable.class, (api) -> ((PaperUnbreakable) api).getHandle(), PaperUnbreakable::new);
|
||||
+ register(DataComponents.CUSTOM_NAME, DataComponentTypes.CUSTOM_NAME, Component.class, PaperAdventure::asVanilla, PaperAdventure::asAdventure);
|
||||
+ register(DataComponents.ITEM_NAME, DataComponentTypes.ITEM_NAME, Component.class, PaperAdventure::asVanilla, PaperAdventure::asAdventure);
|
||||
+ register(DataComponents.LORE, DataComponentTypes.LORE, ItemLore.class, (api) -> ((PaperItemLore) api).getHandle(), PaperItemLore::new);
|
||||
+ register(DataComponents.RARITY, DataComponentTypes.RARITY, ItemRarity.class, (api) -> Rarity.valueOf(api.name()), (nms) -> ItemRarity.valueOf(nms.name()));
|
||||
+ registerUntyped(DataComponents.HIDE_ADDITIONAL_TOOLTIP);
|
||||
+ registerUntyped(DataComponents.HIDE_TOOLTIP);
|
||||
+ registerIdentity(DataComponents.REPAIR_COST, Integer.class);
|
||||
+ registerUntyped(DataComponents.CREATIVE_SLOT_LOCK);
|
||||
+ registerIdentity(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, Boolean.class);
|
||||
+ registerUntyped(DataComponents.INTANGIBLE_PROJECTILE);
|
||||
+ registerUntyped(DataComponents.FIRE_RESISTANT);
|
||||
+ registerIdentity(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, Integer.class);
|
||||
+ registerIdentity(
|
||||
+ DataComponents.MAX_STACK_SIZE,
|
||||
+ DataComponents.MAX_DAMAGE,
|
||||
+ DataComponents.DAMAGE,
|
||||
+ DataComponents.REPAIR_COST,
|
||||
+ DataComponents.OMINOUS_BOTTLE_AMPLIFIER
|
||||
+ );
|
||||
+ registerIdentity(DataComponents.ENCHANTMENT_GLINT_OVERRIDE);
|
||||
+ register(PaperUnbreakable::new, DataComponents.UNBREAKABLE);
|
||||
+ register(
|
||||
+ PaperAdventure::asAdventure,
|
||||
+ PaperAdventure::asVanilla,
|
||||
+ DataComponents.CUSTOM_NAME,
|
||||
+ DataComponents.ITEM_NAME
|
||||
+ );
|
||||
+ register(PaperItemLore::new, DataComponents.LORE);
|
||||
+ register((nms) -> ItemRarity.valueOf(nms.name()), (api) -> Rarity.valueOf(api.name()), DataComponents.RARITY);
|
||||
+ registerUntyped(
|
||||
+ DataComponents.HIDE_ADDITIONAL_TOOLTIP,
|
||||
+ DataComponents.HIDE_TOOLTIP,
|
||||
+ DataComponents.CREATIVE_SLOT_LOCK,
|
||||
+ DataComponents.INTANGIBLE_PROJECTILE,
|
||||
+ DataComponents.FIRE_RESISTANT
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static final Function<Unit, Void> UNIT_TO_API_CONVERTER = $ -> {
|
||||
+ throw new UnsupportedOperationException("Cannot convert the UNIT type to an api value");
|
||||
+ };
|
||||
+
|
||||
+ public static void registerUntyped(net.minecraft.core.component.DataComponentType<Unit> type) {
|
||||
+ ADAPTERS.put(BuiltInRegistries.DATA_COMPONENT_TYPE.getKey(type), new ComponentAdapter<>(type, Void.class, unit -> net.minecraft.util.Unit.INSTANCE, unit -> {throw new UnsupportedOperationException();}));
|
||||
+ }
|
||||
+ public static <COMMON> void registerIdentity(net.minecraft.core.component.DataComponentType<COMMON> type, Class<COMMON> apiTypeValidation) {
|
||||
+ ADAPTERS.put(BuiltInRegistries.DATA_COMPONENT_TYPE.getKey(type), new ComponentAdapter<>(type, apiTypeValidation, (c) -> c, (c) -> c));
|
||||
+ static final Function<Void, Unit> API_TO_UNIT_CONVERTER = $ -> Unit.INSTANCE;
|
||||
+
|
||||
+ @SafeVarargs
|
||||
+ public static void registerUntyped(final DataComponentType<Unit>...types) {
|
||||
+ for (final DataComponentType<Unit> type : types) {
|
||||
+ registerInternal(type, UNIT_TO_API_CONVERTER, API_TO_UNIT_CONVERTER);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static <NMS, API> void register(net.minecraft.core.component.DataComponentType<NMS> type, DataComponentType.Valued<API> dummy, Class<API> apiTypeValidation, Function<API, NMS> nmsConverter, Function<NMS, API> apiConverter) {
|
||||
+ ADAPTERS.put(BuiltInRegistries.DATA_COMPONENT_TYPE.getKey(type), new ComponentAdapter<>(type, apiTypeValidation, nmsConverter, apiConverter));
|
||||
+ @SafeVarargs
|
||||
+ private static <COMMON> void registerIdentity(final DataComponentType<COMMON> ...types) {
|
||||
+ for (final DataComponentType<COMMON> type : types) {
|
||||
+ registerInternal(type, Function.identity(), Function.identity());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record ComponentAdapter<API, NMS>(net.minecraft.core.component.DataComponentType<NMS> type, Class<API> apiTypeValidation, Function<API, NMS> nmsConverter, Function<NMS, API> apiConverter) {
|
||||
+
|
||||
+ @SafeVarargs
|
||||
+ private static <NMS, API extends Handleable<NMS>> void register(final Function<NMS, API> toApiConverter, final DataComponentType<NMS> ...type) {
|
||||
+ register(toApiConverter, Handleable::getHandle, type);
|
||||
+ }
|
||||
+
|
||||
+ @SafeVarargs
|
||||
+ private static <NMS, API> void register(final Function<NMS, API> toApiConverter, final Function<API, NMS> toNmsConverter, final DataComponentType<NMS> ...types) {
|
||||
+ for (final DataComponentType<NMS> type : types) {
|
||||
+ registerInternal(type, toApiConverter, toNmsConverter);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static <NMS, API> void registerInternal(final DataComponentType<NMS> type, final Function<NMS, API> toApiConverter, final Function<API, NMS> toNmsConverter) {
|
||||
+ final ResourceKey<DataComponentType<?>> key = BuiltInRegistries.DATA_COMPONENT_TYPE.getResourceKey(type).orElseThrow();
|
||||
+ if (ADAPTERS.containsKey(key)) {
|
||||
+ throw new IllegalStateException("Duplicate adapter registration for " + key);
|
||||
+ }
|
||||
+ ADAPTERS.put(key, new ComponentAdapter<>(type, toNmsConverter, toApiConverter));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/DataKeyBridgeImpl.java b/src/main/java/io/papermc/paper/datakey/DataKeyBridgeImpl.java
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/DataComponentPatchBridgeImpl.java b/src/main/java/io/papermc/paper/datakey/DataComponentPatchBridgeImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b4422d6047ae060131018a2a0c3b63fb0c598d0c
|
||||
index 0000000000000000000000000000000000000000..12804b65e4c3732cf2347fbb18c99896265331f4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/DataKeyBridgeImpl.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/DataComponentPatchBridgeImpl.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+package io.papermc.paper.datakey;
|
||||
+
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
+import io.papermc.paper.datakey.map.DataComponentMap;
|
||||
+import io.papermc.paper.datakey.map.DataKeyMapBridge;
|
||||
+import io.papermc.paper.datakey.map.PatchedDataComponentMap;
|
||||
+import net.minecraft.core.component.DataComponents;
|
||||
+import net.minecraft.world.item.Item;
|
||||
|
@ -90,7 +134,7 @@ index 0000000000000000000000000000000000000000..b4422d6047ae060131018a2a0c3b63fb
|
|||
+import org.bukkit.craftbukkit.inventory.CraftMetaItem;
|
||||
+import org.bukkit.inventory.meta.ItemMeta;
|
||||
+
|
||||
+public class DataKeyBridgeImpl implements DataKeyMapBridge {
|
||||
+public class DataComponentPatchBridgeImpl implements io.papermc.paper.datakey.map.DataComponentPatchMapBridge {
|
||||
+ @Override
|
||||
+ public PatchedDataComponentMap of(final DataComponentMap keyMap) {
|
||||
+ return new PaperPatchedDataComponentMap(new net.minecraft.core.component.PatchedDataComponentMap(((PaperDataComponentMap) keyMap).nmsComponentMap));
|
||||
|
@ -136,41 +180,47 @@ index 0000000000000000000000000000000000000000..b4422d6047ae060131018a2a0c3b63fb
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/PaperComponentType.java b/src/main/java/io/papermc/paper/datakey/PaperComponentType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1fb8bece884e6f34d984de40ad56f35b0c3a673f
|
||||
index 0000000000000000000000000000000000000000..4b2cf38e83b022b7aad83fc0c48cd9bd38b542ff
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/PaperComponentType.java
|
||||
@@ -0,0 +1,76 @@
|
||||
@@ -0,0 +1,85 @@
|
||||
+package io.papermc.paper.datakey;
|
||||
+
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.Registry;
|
||||
+import org.bukkit.craftbukkit.CraftRegistry;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.craftbukkit.util.Handleable;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public class PaperComponentType<T, NMS> implements DataComponentType, Handleable<net.minecraft.core.component.DataComponentType<NMS>> {
|
||||
+
|
||||
+ static {
|
||||
+ ComponentAdapters.bootstrap();
|
||||
+ }
|
||||
+ public static <T> net.minecraft.core.component.DataComponentType<T> bukkitToMinecraft(DataComponentType bukkitDamageType) {
|
||||
+
|
||||
+ public static <T> net.minecraft.core.component.DataComponentType<T> bukkitToMinecraft(final DataComponentType bukkitDamageType) {
|
||||
+ return CraftRegistry.bukkitToMinecraft(bukkitDamageType);
|
||||
+ }
|
||||
+
|
||||
+ public static DataComponentType minecraftToBukkit(net.minecraft.core.component.DataComponentType<?> minecraftDamageType) {
|
||||
+ return CraftRegistry.minecraftToBukkit(minecraftDamageType, Registries.DATA_COMPONENT_TYPE, Registry.DATA_COMPONENT_TYPES);
|
||||
+ public static DataComponentType minecraftToBukkit(final net.minecraft.core.component.DataComponentType<?> minecraftDataComponentType) {
|
||||
+ return CraftRegistry.minecraftToBukkit(minecraftDataComponentType, Registries.DATA_COMPONENT_TYPE, Registry.DATA_COMPONENT_TYPE);
|
||||
+ }
|
||||
+
|
||||
+ private final NamespacedKey key;
|
||||
+ private final ComponentAdapters.ComponentAdapter<T, NMS> adapter;
|
||||
+ private final ComponentAdapter<NMS, T> adapter;
|
||||
+ private final net.minecraft.core.component.DataComponentType<NMS> dataComponentType;
|
||||
+
|
||||
+ public PaperComponentType(NamespacedKey namespacedKey, net.minecraft.core.component.DataComponentType<?> dataComponentType, ComponentAdapters.ComponentAdapter<T, NMS> adapter) {
|
||||
+ this.key = namespacedKey;
|
||||
+ public PaperComponentType(final NamespacedKey key, final net.minecraft.core.component.DataComponentType<NMS> dataComponentType, final ComponentAdapter<NMS, T> adapter) {
|
||||
+ this.key = key;
|
||||
+ this.adapter = adapter;
|
||||
+ this.dataComponentType = (net.minecraft.core.component.DataComponentType<NMS>) dataComponentType;
|
||||
+ this.dataComponentType = dataComponentType;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -183,7 +233,7 @@ index 0000000000000000000000000000000000000000..1fb8bece884e6f34d984de40ad56f35b
|
|||
+ return this.key;
|
||||
+ }
|
||||
+
|
||||
+ public ComponentAdapters.ComponentAdapter<T, NMS> getAdapter() {
|
||||
+ public ComponentAdapter<NMS, T> getAdapter() {
|
||||
+ return this.adapter;
|
||||
+ }
|
||||
+
|
||||
|
@ -192,43 +242,49 @@ index 0000000000000000000000000000000000000000..1fb8bece884e6f34d984de40ad56f35b
|
|||
+ return this.dataComponentType;
|
||||
+ }
|
||||
+
|
||||
+ public static DataComponentType of(NamespacedKey namespacedKey, net.minecraft.core.component.DataComponentType<?> dataComponentType) {
|
||||
+ ComponentAdapters.ComponentAdapter adapter = ComponentAdapters.ADAPTERS.get(CraftNamespacedKey.toMinecraft(namespacedKey));
|
||||
+ if (adapter != null && adapter.apiTypeValidation() == Void.class) {
|
||||
+ return new NonypedPaperComponentType<>(namespacedKey, dataComponentType, adapter);
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ public static <NMS> DataComponentType of(final NamespacedKey key, final net.minecraft.core.component.DataComponentType<NMS> dataComponentType) {
|
||||
+ final ComponentAdapter<NMS, ?> adapter = (ComponentAdapter<NMS, ?>) ComponentAdapters.ADAPTERS.get(ResourceKey.create(Registries.DATA_COMPONENT_TYPE, CraftNamespacedKey.toMinecraft(key)));
|
||||
+ if (adapter == null) {
|
||||
+ throw new IllegalArgumentException("No adapter found for " + key);
|
||||
+ }
|
||||
+ if (adapter.apiConverter() == ComponentAdapters.API_TO_UNIT_CONVERTER) {
|
||||
+ return new PaperNonValued<>(key, dataComponentType, adapter);
|
||||
+ } else {
|
||||
+ return new TypedPaperComponentType<>(namespacedKey, dataComponentType, adapter);
|
||||
+ return new PaperValued<>(key, dataComponentType, adapter);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class PaperValued<T, NMS> extends PaperComponentType<T, NMS> implements DataComponentType.Valued<T> {
|
||||
+
|
||||
+ private static class TypedPaperComponentType<T, NMS> extends PaperComponentType<T, NMS> implements DataComponentType.Valued<T> {
|
||||
+
|
||||
+ public TypedPaperComponentType(final NamespacedKey namespacedKey, final net.minecraft.core.component.DataComponentType<?> dataComponentType, ComponentAdapters.ComponentAdapter<T, NMS> adapter) {
|
||||
+ public PaperValued(final NamespacedKey namespacedKey, final net.minecraft.core.component.DataComponentType<NMS> dataComponentType, final ComponentAdapter<NMS, T> adapter) {
|
||||
+ super(namespacedKey, dataComponentType, adapter);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class NonypedPaperComponentType<T, NMS> extends PaperComponentType<T, NMS> implements DataComponentType.NonValued {
|
||||
+ private static class PaperNonValued<T, NMS> extends PaperComponentType<T, NMS> implements DataComponentType.NonValued {
|
||||
+
|
||||
+ public NonypedPaperComponentType(final NamespacedKey namespacedKey, final net.minecraft.core.component.DataComponentType<?> dataComponentType, ComponentAdapters.ComponentAdapter<T, NMS> adapter) {
|
||||
+ public PaperNonValued(final NamespacedKey namespacedKey, final net.minecraft.core.component.DataComponentType<NMS> dataComponentType, final ComponentAdapter<NMS, T> adapter) {
|
||||
+ super(namespacedKey, dataComponentType, adapter);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/PaperDataComponentMap.java b/src/main/java/io/papermc/paper/datakey/PaperDataComponentMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b15c167e2ed38bb8b19bfbc0e8e64bb2d8ac7891
|
||||
index 0000000000000000000000000000000000000000..75a1fa58c9d34ef936b7d288e56c354a1f2cbfdf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/PaperDataComponentMap.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -0,0 +1,44 @@
|
||||
+package io.papermc.paper.datakey;
|
||||
+
|
||||
+import io.papermc.paper.datakey.map.DataComponentMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public class PaperDataComponentMap implements DataComponentMap {
|
||||
+
|
||||
+ protected final net.minecraft.core.component.DataComponentMap nmsComponentMap;
|
||||
|
@ -237,11 +293,10 @@ index 0000000000000000000000000000000000000000..b15c167e2ed38bb8b19bfbc0e8e64bb2
|
|||
+ this.nmsComponentMap = patchedDataComponentMap;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public <T> T get(final DataComponentType.Valued<T> type) {
|
||||
+ public <T> @Nullable T get(final DataComponentType.Valued<T> type) {
|
||||
+ PaperComponentType<T, Object> paperComponentType = (PaperComponentType<T, Object>) type;
|
||||
+ ComponentAdapters.ComponentAdapter<T, Object> adapter = paperComponentType.getAdapter();
|
||||
+ ComponentAdapter<Object, T> adapter = paperComponentType.getAdapter();
|
||||
+ Object keyValue = this.nmsComponentMap.get(paperComponentType.getHandle());
|
||||
+
|
||||
+ return keyValue == null ? null : adapter.apiConverter().apply(keyValue);
|
||||
|
@ -266,7 +321,7 @@ index 0000000000000000000000000000000000000000..b15c167e2ed38bb8b19bfbc0e8e64bb2
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/PaperPatchedDataComponentMap.java b/src/main/java/io/papermc/paper/datakey/PaperPatchedDataComponentMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901adeda6b5268
|
||||
index 0000000000000000000000000000000000000000..13a12ccd8ae2cf43fee2c2ef5a7ff79466269fc0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/PaperPatchedDataComponentMap.java
|
||||
@@ -0,0 +1,67 @@
|
||||
|
@ -287,7 +342,7 @@ index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901ade
|
|||
+ @Override
|
||||
+ public <T> void set(final DataComponentType.Valued<T> type, @Nullable final T value) {
|
||||
+ final PaperComponentType<T, Object> paperComponentType = (PaperComponentType<T, Object>) type;
|
||||
+ final ComponentAdapters.ComponentAdapter<T, Object> adapter = paperComponentType.getAdapter();
|
||||
+ final ComponentAdapter<Object, T> adapter = paperComponentType.getAdapter();
|
||||
+
|
||||
+ this.patched().set(paperComponentType.getHandle(), value == null ? null : adapter.nmsConverter().apply(value));
|
||||
+ }
|
||||
|
@ -296,7 +351,7 @@ index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901ade
|
|||
+ @Override
|
||||
+ public void set(final DataComponentType.NonValued type) {
|
||||
+ final PaperComponentType<?, Object> paperComponentType = (PaperComponentType<?, Object>) type;
|
||||
+ final ComponentAdapters.ComponentAdapter<?, Object> adapter = paperComponentType.getAdapter();
|
||||
+ final ComponentAdapter<Object, ?> adapter = paperComponentType.getAdapter();
|
||||
+
|
||||
+ this.patched().set(paperComponentType.getHandle(), adapter.nmsConverter().apply(null));
|
||||
+ }
|
||||
|
@ -305,7 +360,7 @@ index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901ade
|
|||
+ @Override
|
||||
+ public void unset(final DataComponentType type) {
|
||||
+ final PaperComponentType<?, Object> paperComponentType = (PaperComponentType<?, Object>) type;
|
||||
+ final ComponentAdapters.ComponentAdapter<?, Object> adapter = paperComponentType.getAdapter();
|
||||
+ final ComponentAdapter<Object, ?> adapter = paperComponentType.getAdapter();
|
||||
+
|
||||
+ this.patched().remove(adapter.type());
|
||||
+ }
|
||||
|
@ -313,7 +368,7 @@ index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901ade
|
|||
+ @Override
|
||||
+ public void reset(@NotNull final DataComponentType type) {
|
||||
+ final PaperComponentType<?, Object> paperComponentType = (PaperComponentType<?, Object>) type;
|
||||
+ final ComponentAdapters.ComponentAdapter<?, Object> adapter = paperComponentType.getAdapter();
|
||||
+ final ComponentAdapter<Object, ?> adapter = paperComponentType.getAdapter();
|
||||
+
|
||||
+ net.minecraft.core.component.PatchedDataComponentMap patchedDataComponentMap = this.patched();
|
||||
+ patchedDataComponentMap.applyPatch(patchedDataComponentMap.asPatch().forget((forgetType) -> forgetType == adapter.type())); // Apply patch with type removed
|
||||
|
@ -339,98 +394,111 @@ index 0000000000000000000000000000000000000000..cde09884fa94ceedc8cae2884b901ade
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridgesImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5ed6167736270d6a746911ebb1e80dcf63608fca
|
||||
index 0000000000000000000000000000000000000000..cc40b0f3e300e97ff26b0c5e98c46ab455aebe51
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/ComponentTypesBridgesImpl.java
|
||||
@@ -0,0 +1,19 @@
|
||||
@@ -0,0 +1,14 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class ComponentTypesBridgesImpl implements ComponentTypesBridge {
|
||||
+
|
||||
+ @Override
|
||||
+ public Unbreakable.Builder unbreakable() {
|
||||
+ return new PaperUnbreakable.Builder();
|
||||
+ return new PaperUnbreakable.BuilderImpl();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemLore.Builder lore() {
|
||||
+ return new PaperItemLore.Builder();
|
||||
+ return new PaperItemLore.BuilderImpl();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/PaperItemLore.java b/src/main/java/io/papermc/paper/datakey/types/PaperItemLore.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cb25cfc64cb950d5049f2aac2d425e8454c76750
|
||||
index 0000000000000000000000000000000000000000..2129824c82f12d20b77b4d98aa7d62265ac9a540
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/PaperItemLore.java
|
||||
@@ -0,0 +1,52 @@
|
||||
@@ -0,0 +1,68 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.world.item.component.ItemLore;
|
||||
+import org.bukkit.craftbukkit.util.Handleable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.ComponentLike;
|
||||
+import org.bukkit.craftbukkit.util.Handleable;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+public record PaperItemLore(ItemLore itemLore) implements io.papermc.paper.datakey.types.ItemLore, Handleable<ItemLore> {
|
||||
+import static java.util.Collections.unmodifiableList;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public record PaperItemLore(
|
||||
+ net.minecraft.world.item.component.ItemLore itemLore,
|
||||
+ List<Component> lines,
|
||||
+ List<Component> styledLines
|
||||
+) implements ItemLore, Handleable<net.minecraft.world.item.component.ItemLore> {
|
||||
+
|
||||
+ public PaperItemLore(final net.minecraft.world.item.component.ItemLore itemLore) {
|
||||
+ this(
|
||||
+ itemLore,
|
||||
+ unmodifiableList(Lists.transform(itemLore.lines(), PaperAdventure::asAdventure)),
|
||||
+ unmodifiableList(Lists.transform(itemLore.styledLines(), PaperAdventure::asAdventure))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemLore getHandle() {
|
||||
+ public net.minecraft.world.item.component.ItemLore getHandle() {
|
||||
+ return this.itemLore;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<Component> lines() {
|
||||
+ return Lists.transform(this.itemLore.lines(), PaperAdventure::asAdventure);
|
||||
+ return this.lines;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<Component> styledLines() {
|
||||
+ return Lists.transform(this.itemLore.styledLines(), PaperAdventure::asAdventure);
|
||||
+ return this.styledLines;
|
||||
+ }
|
||||
+
|
||||
+ static class Builder implements io.papermc.paper.datakey.types.ItemLore.Builder {
|
||||
+ static final class BuilderImpl implements ItemLore.Builder {
|
||||
+
|
||||
+ private List<Component> componentList = null;
|
||||
+ private List<? extends ComponentLike> componentList = Collections.emptyList();
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.datakey.types.ItemLore.Builder lore(final List<Component> lore) {
|
||||
+ this.componentList = lore;
|
||||
+ public ItemLore.Builder lore(final List<? extends ComponentLike> lore) {
|
||||
+ this.componentList = List.copyOf(lore);
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.datakey.types.@NotNull ItemLore build() {
|
||||
+ if (this.componentList == null) {
|
||||
+ throw new IllegalStateException("Cannot build lore with unset lore!");
|
||||
+ public ItemLore build() {
|
||||
+ if (this.componentList.isEmpty()) {
|
||||
+ return new PaperItemLore(net.minecraft.world.item.component.ItemLore.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ List<net.minecraft.network.chat.Component> nmsComponentList = new ArrayList<>(componentList.size());
|
||||
+ for (Component adventure : componentList) {
|
||||
+ nmsComponentList.add(PaperAdventure.asVanilla(adventure));
|
||||
+ final List<net.minecraft.network.chat.Component> nmsComponentList = new ArrayList<>(this.componentList.size());
|
||||
+ for (final ComponentLike adventure : this.componentList) {
|
||||
+ nmsComponentList.add(PaperAdventure.asVanilla(adventure.asComponent()));
|
||||
+ }
|
||||
+ return new PaperItemLore(new net.minecraft.world.item.component.ItemLore(nmsComponentList));
|
||||
+ return new PaperItemLore(new net.minecraft.world.item.component.ItemLore(unmodifiableList(nmsComponentList)));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datakey/types/PaperUnbreakable.java b/src/main/java/io/papermc/paper/datakey/types/PaperUnbreakable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..58087f382b27bb9e609d71fcec7e9080eabaa0d4
|
||||
index 0000000000000000000000000000000000000000..90cd022e6472d161f14db5f2eae0110fa2617fab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datakey/types/PaperUnbreakable.java
|
||||
@@ -0,0 +1,38 @@
|
||||
@@ -0,0 +1,40 @@
|
||||
+package io.papermc.paper.datakey.types;
|
||||
+
|
||||
+import org.bukkit.craftbukkit.util.Handleable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public record PaperUnbreakable(net.minecraft.world.item.component.Unbreakable unbreakable) implements Unbreakable, Handleable<net.minecraft.world.item.component.Unbreakable> {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -439,8 +507,8 @@ index 0000000000000000000000000000000000000000..58087f382b27bb9e609d71fcec7e9080
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Unbreakable showInTooltip(final boolean hideInTooltip) {
|
||||
+ return new PaperUnbreakable(this.unbreakable.withTooltip(hideInTooltip));
|
||||
+ public Unbreakable showInTooltip(final boolean showInTooltip) {
|
||||
+ return new PaperUnbreakable(this.unbreakable.withTooltip(showInTooltip));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -448,9 +516,9 @@ index 0000000000000000000000000000000000000000..58087f382b27bb9e609d71fcec7e9080
|
|||
+ return this.unbreakable;
|
||||
+ }
|
||||
+
|
||||
+ static class Builder implements Unbreakable.Builder {
|
||||
+ static final class BuilderImpl implements Unbreakable.Builder {
|
||||
+
|
||||
+ private boolean showInTooltip = true;
|
||||
+ private boolean showInTooltip = true; // should match the default value in the Unbreakable codec
|
||||
+
|
||||
+ @Override
|
||||
+ public Unbreakable.Builder showInTooltip(final boolean showInTooltip) {
|
||||
|
@ -459,7 +527,7 @@ index 0000000000000000000000000000000000000000..58087f382b27bb9e609d71fcec7e9080
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Unbreakable build() {
|
||||
+ public Unbreakable build() {
|
||||
+ return new PaperUnbreakable(new net.minecraft.world.item.component.Unbreakable(this.showInTooltip));
|
||||
+ }
|
||||
+ }
|
||||
|
@ -586,13 +654,13 @@ index 38454fdc978a24a35e685e65e9b41323781c3ead..6d0a7dc5ac0862c6c4090d877b764ab9
|
|||
if (this.hasDisplayName()) {
|
||||
itemTag.put(CraftMetaItem.NAME, this.displayName);
|
||||
}
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataKeyMapBridge b/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataKeyMapBridge
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataComponentPatchMapBridge b/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataComponentPatchMapBridge
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2b625546a2053c9131124d983f1a8c0512e7c88c
|
||||
index 0000000000000000000000000000000000000000..9fd7c2b9089b3a13834fcca23e9a7c47c0cead83
|
||||
--- /dev/null
|
||||
+++ b/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataKeyMapBridge
|
||||
+++ b/src/main/resources/META-INF/services/io.papermc.paper.datakey.map.DataComponentPatchMapBridge
|
||||
@@ -0,0 +1 @@
|
||||
+io.papermc.paper.datakey.DataKeyBridgeImpl
|
||||
+io.papermc.paper.datakey.DataComponentPatchBridgeImpl
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datakey.types.ComponentTypesBridge b/src/main/resources/META-INF/services/io.papermc.paper.datakey.types.ComponentTypesBridge
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d43e2b2d0e86ed585ba7bfd4e26d625960cc6fe7
|
||||
|
|
Loading…
Reference in New Issue