add one toBuilder method for food
This commit is contained in:
parent
699e8f58eb
commit
f45b2b432a
2 changed files with 214 additions and 175 deletions
|
@ -59,6 +59,30 @@ index 0000000000000000000000000000000000000000..5e0b099abc564b1bbd0e1541eac9cec9
|
|||
+ @NonNull BlockPredicate build();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java b/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cf7a67733b226a531f100cd40c64cb06bdc461ca
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/BuildableDataComponent.java
|
||||
@@ -0,0 +1,18 @@
|
||||
+package io.papermc.paper.datacomponent;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+
|
||||
+@ApiStatus.Experimental
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface BuildableDataComponent<C extends BuildableDataComponent<C, B>, B extends DataComponentBuilder<C>> {
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new builder from this data component.
|
||||
+ *
|
||||
+ * @return a new builder
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ @NonNull B toBuilder();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentBuilder.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentBuilder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e56c3b74bc22c382e7cf987e95c2f8e6bbe5611b
|
||||
|
@ -454,7 +478,7 @@ index 0000000000000000000000000000000000000000..4a99e023e4593dc0ccc05b9af292b44d
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..093baebdc1cc306f7929be9c1a2675e5993eceee
|
||||
index 0000000000000000000000000000000000000000..c53db2ea345fc44c9ccb94371104c9a60df88945
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java
|
||||
@@ -0,0 +1,70 @@
|
||||
|
@ -489,7 +513,7 @@ index 0000000000000000000000000000000000000000..093baebdc1cc306f7929be9c1a2675e5
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static BannerPatternLayers.@NonNull Builder bannerPatternLayers() {
|
||||
+ return ComponentTypesBridge.bridge().bannerPatternLayers();
|
||||
+ return ItemComponentTypesBridge.bridge().bannerPatternLayers();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -530,7 +554,7 @@ index 0000000000000000000000000000000000000000..093baebdc1cc306f7929be9c1a2675e5
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5594cd19a26c7c8400816846222eee93c45a1bf2
|
||||
index 0000000000000000000000000000000000000000..b77d2052489ad57e58961663749e156bcb5462bd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/BlockItemDataProperties.java
|
||||
@@ -0,0 +1,50 @@
|
||||
|
@ -553,7 +577,7 @@ index 0000000000000000000000000000000000000000..5594cd19a26c7c8400816846222eee93
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static BlockItemDataProperties.@NonNull Builder blockItemStateProperties() {
|
||||
+ return ComponentTypesBridge.bridge().blockItemStateProperties();
|
||||
+ return ItemComponentTypesBridge.bridge().blockItemStateProperties();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -586,7 +610,7 @@ index 0000000000000000000000000000000000000000..5594cd19a26c7c8400816846222eee93
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5e28cb5f6371eaa3fde71d13daafa349c4f9e95d
|
||||
index 0000000000000000000000000000000000000000..6a244d9f7dae25f53dddb3df5591b73916cc3237
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java
|
||||
@@ -0,0 +1,70 @@
|
||||
|
@ -616,12 +640,12 @@ index 0000000000000000000000000000000000000000..5e28cb5f6371eaa3fde71d13daafa349
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NonNull BundleContents bundleContents(final @NonNull List<@NonNull ItemStack> contents) {
|
||||
+ return ComponentTypesBridge.bridge().bundleContents().addAll(contents).build();
|
||||
+ return ItemComponentTypesBridge.bridge().bundleContents().addAll(contents).build();
|
||||
+ }
|
||||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static BundleContents.@NonNull Builder bundleContents() {
|
||||
+ return ComponentTypesBridge.bridge().bundleContents();
|
||||
+ return ItemComponentTypesBridge.bridge().bundleContents();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -662,7 +686,7 @@ index 0000000000000000000000000000000000000000..5e28cb5f6371eaa3fde71d13daafa349
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c7c9f5b48e4d3b79d65cf9f56114b686d0fcbbac
|
||||
index 0000000000000000000000000000000000000000..df663aeeb1ebe547fff956bdda4455bd47eeb537
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java
|
||||
@@ -0,0 +1,70 @@
|
||||
|
@ -697,7 +721,7 @@ index 0000000000000000000000000000000000000000..c7c9f5b48e4d3b79d65cf9f56114b686
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ChargedProjectiles.@NonNull Builder chargedProjectiles() {
|
||||
+ return ComponentTypesBridge.bridge().chargedProjectiles();
|
||||
+ return ItemComponentTypesBridge.bridge().chargedProjectiles();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -736,107 +760,9 @@ index 0000000000000000000000000000000000000000..c7c9f5b48e4d3b79d65cf9f56114b686
|
|||
+ @NonNull Builder addAll(@NonNull List<@NonNull ItemStack> stacks);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridge.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fb1a5b748641fce58387509fbfc10a655ff09036
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridge.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
+import io.papermc.paper.registry.set.RegistryKeySet;
|
||||
+import io.papermc.paper.util.Filtered;
|
||||
+import java.util.Optional;
|
||||
+import java.util.ServiceLoader;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.util.TriState;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.block.BlockType;
|
||||
+import org.bukkit.inventory.meta.trim.ArmorTrim;
|
||||
+import org.bukkit.map.MapCursor;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+interface ComponentTypesBridge {
|
||||
+
|
||||
+ Optional<ComponentTypesBridge> BRIDGE = ServiceLoader.load(ComponentTypesBridge.class).findFirst();
|
||||
+
|
||||
+ static ComponentTypesBridge bridge() {
|
||||
+ return BRIDGE.orElseThrow();
|
||||
+ }
|
||||
+
|
||||
+ ChargedProjectiles.Builder chargedProjectiles();
|
||||
+
|
||||
+ PotDecorations.Builder potDecorations();
|
||||
+
|
||||
+ Unbreakable.Builder unbreakable();
|
||||
+
|
||||
+ ItemLore.Builder lore();
|
||||
+
|
||||
+ ItemEnchantments.Builder enchantments();
|
||||
+
|
||||
+ ItemAttributeModifiers.Builder modifiers();
|
||||
+
|
||||
+ FoodProperties.Builder food();
|
||||
+
|
||||
+ FoodProperties.PossibleEffect foodEffect(PotionEffect effect, float probability);
|
||||
+
|
||||
+ DyedItemColor.Builder dyedItemColor();
|
||||
+
|
||||
+ PotionContents.Builder potionContents();
|
||||
+
|
||||
+ BundleContents.Builder bundleContents();
|
||||
+
|
||||
+ SuspiciousStewEffects.Builder suspiciousStewEffects();
|
||||
+
|
||||
+ MapItemColor.Builder mapItemColor();
|
||||
+
|
||||
+ MapDecorations.Builder mapDecorations();
|
||||
+
|
||||
+ MapDecorations.DecorationEntry decorationEntry(MapCursor.Type type, double x, double z, float rotation);
|
||||
+
|
||||
+ SeededContainerLoot.Builder seededContainerLoot(Key lootTableKey);
|
||||
+
|
||||
+ WrittenBookContent.Builder writtenBookContent(Filtered<String> title, String author);
|
||||
+
|
||||
+ WritableBookContent.Builder writeableBookContent();
|
||||
+
|
||||
+ ItemArmorTrim.Builder itemArmorTrim(ArmorTrim armorTrim);
|
||||
+
|
||||
+ LodestoneTracker.Builder lodestoneTracker();
|
||||
+
|
||||
+ Fireworks.Builder fireworks();
|
||||
+
|
||||
+ ResolvableProfile.Builder resolvableProfile();
|
||||
+
|
||||
+ ResolvableProfile resolvableProfile(PlayerProfile profile);
|
||||
+
|
||||
+ BannerPatternLayers.Builder bannerPatternLayers();
|
||||
+
|
||||
+ BlockItemDataProperties.Builder blockItemStateProperties();
|
||||
+
|
||||
+ ItemContainerContents.Builder itemContainerContents();
|
||||
+
|
||||
+ JukeboxPlayable.Builder jukeboxPlayable(JukeboxSong song);
|
||||
+
|
||||
+ Tool.Builder tool();
|
||||
+
|
||||
+ Tool.Rule rule(RegistryKeySet<BlockType> blocks, @Nullable Float speed, TriState correctForDrops);
|
||||
+
|
||||
+ ItemAdventurePredicate.Builder itemAdventurePredicate();
|
||||
+
|
||||
+ CustomModelData customModelData(int id);
|
||||
+
|
||||
+ MapId mapId(int id);
|
||||
+
|
||||
+ LockCode lockCode(String code);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java b/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..31b90e539fe319f45d7237eccc173e99e67019c6
|
||||
index 0000000000000000000000000000000000000000..998eb257bf88f313a812802fd7dd45320893d224
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java
|
||||
@@ -0,0 +1,27 @@
|
||||
|
@ -856,7 +782,7 @@ index 0000000000000000000000000000000000000000..31b90e539fe319f45d7237eccc173e99
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NonNull CustomModelData customModelData(final int id) {
|
||||
+ return ComponentTypesBridge.bridge().customModelData(id);
|
||||
+ return ItemComponentTypesBridge.bridge().customModelData(id);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -869,7 +795,7 @@ index 0000000000000000000000000000000000000000..31b90e539fe319f45d7237eccc173e99
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8d934dae0a70a4cc03f8505475775328eb0802e7
|
||||
index 0000000000000000000000000000000000000000..78afe5d6f3796e2c1ee945c8bcac167ce847c1f4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java
|
||||
@@ -0,0 +1,52 @@
|
||||
|
@ -896,7 +822,7 @@ index 0000000000000000000000000000000000000000..8d934dae0a70a4cc03f8505475775328
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static DyedItemColor.@NonNull Builder dyedItemColor() {
|
||||
+ return ComponentTypesBridge.bridge().dyedItemColor();
|
||||
+ return ItemComponentTypesBridge.bridge().dyedItemColor();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -927,7 +853,7 @@ index 0000000000000000000000000000000000000000..8d934dae0a70a4cc03f8505475775328
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java b/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8bc11570f5d1954ec9edda88214aed7c7b74b266
|
||||
index 0000000000000000000000000000000000000000..127ee7a9a89783df9eee78aa94ede7390f606fdc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/Fireworks.java
|
||||
@@ -0,0 +1,83 @@
|
||||
|
@ -957,7 +883,7 @@ index 0000000000000000000000000000000000000000..8bc11570f5d1954ec9edda88214aed7c
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static Fireworks.@NonNull Builder fireworks() {
|
||||
+ return ComponentTypesBridge.bridge().fireworks();
|
||||
+ return ItemComponentTypesBridge.bridge().fireworks();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1016,12 +942,13 @@ index 0000000000000000000000000000000000000000..8bc11570f5d1954ec9edda88214aed7c
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ee1b48bd5accf85c23d75ba969c8bb0b0796479d
|
||||
index 0000000000000000000000000000000000000000..b28bdb326f6579840813c4c390c0fb65fa3f0cb5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/FoodProperties.java
|
||||
@@ -0,0 +1,161 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import io.papermc.paper.datacomponent.BuildableDataComponent;
|
||||
+import io.papermc.paper.datacomponent.DataComponentBuilder;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
|
@ -1032,7 +959,6 @@ index 0000000000000000000000000000000000000000..ee1b48bd5accf85c23d75ba969c8bb0b
|
|||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+
|
||||
+/**
|
||||
|
@ -1041,11 +967,11 @@ index 0000000000000000000000000000000000000000..ee1b48bd5accf85c23d75ba969c8bb0b
|
|||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface FoodProperties {
|
||||
+public interface FoodProperties extends BuildableDataComponent<FoodProperties, FoodProperties.Builder> {
|
||||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static FoodProperties.@NonNull Builder food() {
|
||||
+ return ComponentTypesBridge.bridge().food();
|
||||
+ return ItemComponentTypesBridge.bridge().food();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1105,7 +1031,7 @@ index 0000000000000000000000000000000000000000..ee1b48bd5accf85c23d75ba969c8bb0b
|
|||
+ */
|
||||
+ @Contract(value = "_, _ -> new", pure = true)
|
||||
+ static @NonNull PossibleEffect of(final @NonNull PotionEffect effect, final float probability) {
|
||||
+ return ComponentTypesBridge.bridge().foodEffect(effect, probability);
|
||||
+ return ItemComponentTypesBridge.bridge().foodEffect(effect, probability);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1183,7 +1109,7 @@ index 0000000000000000000000000000000000000000..ee1b48bd5accf85c23d75ba969c8bb0b
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ec8c471149fae4824724dd303d437ed34bba1fb4
|
||||
index 0000000000000000000000000000000000000000..e773dc17543d6826d771b9958db9ab9140bcaeb0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java
|
||||
@@ -0,0 +1,69 @@
|
||||
|
@ -1218,7 +1144,7 @@ index 0000000000000000000000000000000000000000..ec8c471149fae4824724dd303d437ed3
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemAdventurePredicate.@NonNull Builder itemAdventurePredicate() {
|
||||
+ return ComponentTypesBridge.bridge().itemAdventurePredicate();
|
||||
+ return ItemComponentTypesBridge.bridge().itemAdventurePredicate();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1258,7 +1184,7 @@ index 0000000000000000000000000000000000000000..ec8c471149fae4824724dd303d437ed3
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b9a2ce4fc70845fc7c2615252ade4ca896ec85f
|
||||
index 0000000000000000000000000000000000000000..c553b3d1edb8fac9cc644f7f9399599bbb7c50a5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java
|
||||
@@ -0,0 +1,51 @@
|
||||
|
@ -1284,7 +1210,7 @@ index 0000000000000000000000000000000000000000..7b9a2ce4fc70845fc7c2615252ade4ca
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static ItemArmorTrim.@NonNull Builder itemArmorTrim(final @NonNull ArmorTrim armorTrim) {
|
||||
+ return ComponentTypesBridge.bridge().itemArmorTrim(armorTrim);
|
||||
+ return ItemComponentTypesBridge.bridge().itemArmorTrim(armorTrim);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1315,7 +1241,7 @@ index 0000000000000000000000000000000000000000..7b9a2ce4fc70845fc7c2615252ade4ca
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b223c50af7d72bd887eb8eebe028351b3693e8c2
|
||||
index 0000000000000000000000000000000000000000..79a7f5387142aa267655f6243a8f9291b1e2c843
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java
|
||||
@@ -0,0 +1,73 @@
|
||||
|
@ -1339,7 +1265,7 @@ index 0000000000000000000000000000000000000000..b223c50af7d72bd887eb8eebe028351b
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemAttributeModifiers.@NonNull Builder itemAttributes() {
|
||||
+ return ComponentTypesBridge.bridge().modifiers();
|
||||
+ return ItemComponentTypesBridge.bridge().modifiers();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1392,9 +1318,107 @@ index 0000000000000000000000000000000000000000..b223c50af7d72bd887eb8eebe028351b
|
|||
+ @NonNull Builder addModifier(@NonNull Attribute attribute, @NonNull AttributeModifier modifier);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9ecd83fdc364700ef5aaf3ac63f41818f4a91a07
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridge.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
+import io.papermc.paper.registry.set.RegistryKeySet;
|
||||
+import io.papermc.paper.util.Filtered;
|
||||
+import java.util.Optional;
|
||||
+import java.util.ServiceLoader;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.util.TriState;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.block.BlockType;
|
||||
+import org.bukkit.inventory.meta.trim.ArmorTrim;
|
||||
+import org.bukkit.map.MapCursor;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+interface ItemComponentTypesBridge {
|
||||
+
|
||||
+ Optional<ItemComponentTypesBridge> BRIDGE = ServiceLoader.load(ItemComponentTypesBridge.class).findFirst();
|
||||
+
|
||||
+ static ItemComponentTypesBridge bridge() {
|
||||
+ return BRIDGE.orElseThrow();
|
||||
+ }
|
||||
+
|
||||
+ ChargedProjectiles.Builder chargedProjectiles();
|
||||
+
|
||||
+ PotDecorations.Builder potDecorations();
|
||||
+
|
||||
+ Unbreakable.Builder unbreakable();
|
||||
+
|
||||
+ ItemLore.Builder lore();
|
||||
+
|
||||
+ ItemEnchantments.Builder enchantments();
|
||||
+
|
||||
+ ItemAttributeModifiers.Builder modifiers();
|
||||
+
|
||||
+ FoodProperties.Builder food();
|
||||
+
|
||||
+ FoodProperties.PossibleEffect foodEffect(PotionEffect effect, float probability);
|
||||
+
|
||||
+ DyedItemColor.Builder dyedItemColor();
|
||||
+
|
||||
+ PotionContents.Builder potionContents();
|
||||
+
|
||||
+ BundleContents.Builder bundleContents();
|
||||
+
|
||||
+ SuspiciousStewEffects.Builder suspiciousStewEffects();
|
||||
+
|
||||
+ MapItemColor.Builder mapItemColor();
|
||||
+
|
||||
+ MapDecorations.Builder mapDecorations();
|
||||
+
|
||||
+ MapDecorations.DecorationEntry decorationEntry(MapCursor.Type type, double x, double z, float rotation);
|
||||
+
|
||||
+ SeededContainerLoot.Builder seededContainerLoot(Key lootTableKey);
|
||||
+
|
||||
+ WrittenBookContent.Builder writtenBookContent(Filtered<String> title, String author);
|
||||
+
|
||||
+ WritableBookContent.Builder writeableBookContent();
|
||||
+
|
||||
+ ItemArmorTrim.Builder itemArmorTrim(ArmorTrim armorTrim);
|
||||
+
|
||||
+ LodestoneTracker.Builder lodestoneTracker();
|
||||
+
|
||||
+ Fireworks.Builder fireworks();
|
||||
+
|
||||
+ ResolvableProfile.Builder resolvableProfile();
|
||||
+
|
||||
+ ResolvableProfile resolvableProfile(PlayerProfile profile);
|
||||
+
|
||||
+ BannerPatternLayers.Builder bannerPatternLayers();
|
||||
+
|
||||
+ BlockItemDataProperties.Builder blockItemStateProperties();
|
||||
+
|
||||
+ ItemContainerContents.Builder itemContainerContents();
|
||||
+
|
||||
+ JukeboxPlayable.Builder jukeboxPlayable(JukeboxSong song);
|
||||
+
|
||||
+ Tool.Builder tool();
|
||||
+
|
||||
+ Tool.Rule rule(RegistryKeySet<BlockType> blocks, @Nullable Float speed, TriState correctForDrops);
|
||||
+
|
||||
+ ItemAdventurePredicate.Builder itemAdventurePredicate();
|
||||
+
|
||||
+ CustomModelData customModelData(int id);
|
||||
+
|
||||
+ MapId mapId(int id);
|
||||
+
|
||||
+ LockCode lockCode(String code);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c5e6a57702f6b11bcf964ac1fe6d45e33d350ac6
|
||||
index 0000000000000000000000000000000000000000..069de65bc6c15dd9270c251a9bb44ac773eaf615
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java
|
||||
@@ -0,0 +1,67 @@
|
||||
|
@ -1429,7 +1453,7 @@ index 0000000000000000000000000000000000000000..c5e6a57702f6b11bcf964ac1fe6d45e3
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemContainerContents.@NonNull Builder containerContents() {
|
||||
+ return ComponentTypesBridge.bridge().itemContainerContents();
|
||||
+ return ItemComponentTypesBridge.bridge().itemContainerContents();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1467,7 +1491,7 @@ index 0000000000000000000000000000000000000000..c5e6a57702f6b11bcf964ac1fe6d45e3
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e92e008122cffadd3cbd39eef9f5638c0b4c906f
|
||||
index 0000000000000000000000000000000000000000..427a32e729061ff9ad8df4e1169b736006b2a3ae
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java
|
||||
@@ -0,0 +1,67 @@
|
||||
|
@ -1498,7 +1522,7 @@ index 0000000000000000000000000000000000000000..e92e008122cffadd3cbd39eef9f5638c
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemEnchantments.@NonNull Builder itemEnchantments() {
|
||||
+ return ComponentTypesBridge.bridge().enchantments();
|
||||
+ return ItemComponentTypesBridge.bridge().enchantments();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1540,7 +1564,7 @@ index 0000000000000000000000000000000000000000..e92e008122cffadd3cbd39eef9f5638c
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d70ee866d656bb79d8c2cbccb5a58f3e19617d84
|
||||
index 0000000000000000000000000000000000000000..15fba82f6b3605c10d164896d90121727d58ccf9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemLore.java
|
||||
@@ -0,0 +1,83 @@
|
||||
|
@ -1570,7 +1594,7 @@ index 0000000000000000000000000000000000000000..d70ee866d656bb79d8c2cbccb5a58f3e
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ItemLore.@NonNull Builder lore() {
|
||||
+ return ComponentTypesBridge.bridge().lore();
|
||||
+ return ItemComponentTypesBridge.bridge().lore();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1629,7 +1653,7 @@ index 0000000000000000000000000000000000000000..d70ee866d656bb79d8c2cbccb5a58f3e
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java b/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9afaeff2294f613f2e425617c9c6f39ac3a5e03b
|
||||
index 0000000000000000000000000000000000000000..26ca1143b74d4b0c4e48865dc94128ec5cf01f89
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java
|
||||
@@ -0,0 +1,42 @@
|
||||
|
@ -1651,7 +1675,7 @@ index 0000000000000000000000000000000000000000..9afaeff2294f613f2e425617c9c6f39a
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static JukeboxPlayable.@NonNull Builder jukeboxPlayable(final @NonNull JukeboxSong song) {
|
||||
+ return ComponentTypesBridge.bridge().jukeboxPlayable(song);
|
||||
+ return ItemComponentTypesBridge.bridge().jukeboxPlayable(song);
|
||||
+ }
|
||||
+
|
||||
+ @Contract(pure = true)
|
||||
|
@ -1677,7 +1701,7 @@ index 0000000000000000000000000000000000000000..9afaeff2294f613f2e425617c9c6f39a
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java b/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..60e198e44510e9b4295442610a15aaa50d921704
|
||||
index 0000000000000000000000000000000000000000..6386d859ec06ffd23553767d8f87d85ed1e6a4df
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java
|
||||
@@ -0,0 +1,22 @@
|
||||
|
@ -1697,7 +1721,7 @@ index 0000000000000000000000000000000000000000..60e198e44510e9b4295442610a15aaa5
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NonNull LockCode lockCode(final @NonNull String code) {
|
||||
+ return ComponentTypesBridge.bridge().lockCode(code);
|
||||
+ return ItemComponentTypesBridge.bridge().lockCode(code);
|
||||
+ }
|
||||
+
|
||||
+ @Contract(pure = true)
|
||||
|
@ -1705,7 +1729,7 @@ index 0000000000000000000000000000000000000000..60e198e44510e9b4295442610a15aaa5
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java b/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1dba59fffe85580829b5e22ae6d0d21f8004a4d9
|
||||
index 0000000000000000000000000000000000000000..a2aa9c0f7dcd324bfcb1e74164c8253de56e98b2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java
|
||||
@@ -0,0 +1,71 @@
|
||||
|
@ -1733,7 +1757,7 @@ index 0000000000000000000000000000000000000000..1dba59fffe85580829b5e22ae6d0d21f
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static LodestoneTracker.@NonNull Builder lodestoneTracker() {
|
||||
+ return ComponentTypesBridge.bridge().lodestoneTracker();
|
||||
+ return ItemComponentTypesBridge.bridge().lodestoneTracker();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1782,7 +1806,7 @@ index 0000000000000000000000000000000000000000..1dba59fffe85580829b5e22ae6d0d21f
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..17a3400bf4066358a0bf9a28e4182bc2abe2a2b4
|
||||
index 0000000000000000000000000000000000000000..992cd586337f290056d4d66f2e67757686a5fc6e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java
|
||||
@@ -0,0 +1,120 @@
|
||||
|
@ -1812,7 +1836,7 @@ index 0000000000000000000000000000000000000000..17a3400bf4066358a0bf9a28e4182bc2
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static MapDecorations.@NonNull Builder mapDecorations() {
|
||||
+ return ComponentTypesBridge.bridge().mapDecorations();
|
||||
+ return ItemComponentTypesBridge.bridge().mapDecorations();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1841,7 +1865,7 @@ index 0000000000000000000000000000000000000000..17a3400bf4066358a0bf9a28e4182bc2
|
|||
+
|
||||
+ @Contract(value = "_, _, _, _ -> new", pure = true)
|
||||
+ static @NonNull DecorationEntry of(final MapCursor.@NonNull Type type, final double x, final double z, final float rotation) {
|
||||
+ return ComponentTypesBridge.bridge().decorationEntry(type, x, z, rotation);
|
||||
+ return ItemComponentTypesBridge.bridge().decorationEntry(type, x, z, rotation);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1908,7 +1932,7 @@ index 0000000000000000000000000000000000000000..17a3400bf4066358a0bf9a28e4182bc2
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapId.java b/src/main/java/io/papermc/paper/datacomponent/item/MapId.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9a5fd530532596e4a5d651e75c7fd803b33182b2
|
||||
index 0000000000000000000000000000000000000000..82e497eb4dcb5a2efb88b2b69d2189e513493119
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/MapId.java
|
||||
@@ -0,0 +1,27 @@
|
||||
|
@ -1928,7 +1952,7 @@ index 0000000000000000000000000000000000000000..9a5fd530532596e4a5d651e75c7fd803
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NonNull MapId mapId(final int id) {
|
||||
+ return ComponentTypesBridge.bridge().mapId(id);
|
||||
+ return ItemComponentTypesBridge.bridge().mapId(id);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1941,7 +1965,7 @@ index 0000000000000000000000000000000000000000..9a5fd530532596e4a5d651e75c7fd803
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java b/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e4f1a3b723bc0af76f721a80104ad9fc37e0ab2e
|
||||
index 0000000000000000000000000000000000000000..b385132b23c3f52f327f8a699fdb8cbafc2ae640
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/MapItemColor.java
|
||||
@@ -0,0 +1,41 @@
|
||||
|
@ -1962,7 +1986,7 @@ index 0000000000000000000000000000000000000000..e4f1a3b723bc0af76f721a80104ad9fc
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static MapItemColor.@NonNull Builder mapItemColor() {
|
||||
+ return ComponentTypesBridge.bridge().mapItemColor();
|
||||
+ return ItemComponentTypesBridge.bridge().mapItemColor();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -1988,14 +2012,13 @@ index 0000000000000000000000000000000000000000..e4f1a3b723bc0af76f721a80104ad9fc
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..52c88f1e36ac00f8eb8c5b67049024184fd7ba44
|
||||
index 0000000000000000000000000000000000000000..35958f84bf93270c53ad8b09483bab503d85aae3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java
|
||||
@@ -0,0 +1,109 @@
|
||||
@@ -0,0 +1,108 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import io.papermc.paper.datacomponent.DataComponentBuilder;
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
@ -2018,7 +2041,7 @@ index 0000000000000000000000000000000000000000..52c88f1e36ac00f8eb8c5b6704902418
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static PotDecorations.@NonNull Builder potDecorations() {
|
||||
+ return ComponentTypesBridge.bridge().potDecorations();
|
||||
+ return ItemComponentTypesBridge.bridge().potDecorations();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2103,7 +2126,7 @@ index 0000000000000000000000000000000000000000..52c88f1e36ac00f8eb8c5b6704902418
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f2ccaf83e23c3e2138ec0dde5e06757460f9941a
|
||||
index 0000000000000000000000000000000000000000..e212f5401312c64c6c25af19ba9dc8e511157409
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java
|
||||
@@ -0,0 +1,100 @@
|
||||
|
@ -2130,7 +2153,7 @@ index 0000000000000000000000000000000000000000..f2ccaf83e23c3e2138ec0dde5e067574
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static PotionContents.@NonNull Builder potionContents() { // can't name it just "enchantments"
|
||||
+ return ComponentTypesBridge.bridge().potionContents();
|
||||
+ return ItemComponentTypesBridge.bridge().potionContents();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2209,7 +2232,7 @@ index 0000000000000000000000000000000000000000..f2ccaf83e23c3e2138ec0dde5e067574
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dffe31799e1130d0476e8b44df2bfaf1a775bb94
|
||||
index 0000000000000000000000000000000000000000..85d9a14b3f8abf99793118e5d66cbf3eca66616a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java
|
||||
@@ -0,0 +1,94 @@
|
||||
|
@ -2238,12 +2261,12 @@ index 0000000000000000000000000000000000000000..dffe31799e1130d0476e8b44df2bfaf1
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NonNull ResolvableProfile resolvableProfile(final @NonNull PlayerProfile profile) {
|
||||
+ return ComponentTypesBridge.bridge().resolvableProfile(profile);
|
||||
+ return ItemComponentTypesBridge.bridge().resolvableProfile(profile);
|
||||
+ }
|
||||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static ResolvableProfile.@NonNull Builder resolvableProfile() {
|
||||
+ return ComponentTypesBridge.bridge().resolvableProfile();
|
||||
+ return ItemComponentTypesBridge.bridge().resolvableProfile();
|
||||
+ }
|
||||
+
|
||||
+ @Contract(pure = true)
|
||||
|
@ -2309,7 +2332,7 @@ index 0000000000000000000000000000000000000000..dffe31799e1130d0476e8b44df2bfaf1
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java b/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0aa108dc34d89c7c13a79ca8f83e1b4a0e259785
|
||||
index 0000000000000000000000000000000000000000..9bef9285781a4294ee5640c42b9fb2a3010d76b5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/SeededContainerLoot.java
|
||||
@@ -0,0 +1,70 @@
|
||||
|
@ -2336,7 +2359,7 @@ index 0000000000000000000000000000000000000000..0aa108dc34d89c7c13a79ca8f83e1b4a
|
|||
+
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static SeededContainerLoot.@NonNull Builder seededContainerLoot(final @NonNull Key lootTableKey) {
|
||||
+ return ComponentTypesBridge.bridge().seededContainerLoot(lootTableKey);
|
||||
+ return ItemComponentTypesBridge.bridge().seededContainerLoot(lootTableKey);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2385,10 +2408,10 @@ index 0000000000000000000000000000000000000000..0aa108dc34d89c7c13a79ca8f83e1b4a
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java b/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..68090e845a6f6e7172a275c0075f201658599027
|
||||
index 0000000000000000000000000000000000000000..987a3d7ee4874053f89dc5ebcb1a3ebf2bf58ae5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,51 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
@ -2421,7 +2444,12 @@ index 0000000000000000000000000000000000000000..68090e845a6f6e7172a275c0075f2016
|
|||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ @NonNull T showInTooltip(boolean showInTooltip);
|
||||
+
|
||||
+ /**
|
||||
+ * A builder for creating a {@link ShownInTooltip} data component.
|
||||
+ * @param <B> builder type
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Builder<B> {
|
||||
+
|
||||
+ /**
|
||||
|
@ -2437,7 +2465,7 @@ index 0000000000000000000000000000000000000000..68090e845a6f6e7172a275c0075f2016
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..481741cf6b25011b7b906262565666304947217e
|
||||
index 0000000000000000000000000000000000000000..05f229e011c2cd87ab257ad92b45d9906e3f5df0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java
|
||||
@@ -0,0 +1,71 @@
|
||||
|
@ -2473,7 +2501,7 @@ index 0000000000000000000000000000000000000000..481741cf6b25011b7b90626256566630
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static SuspiciousStewEffects.@NonNull Builder suspiciousStewEffects() {
|
||||
+ return ComponentTypesBridge.bridge().suspiciousStewEffects();
|
||||
+ return ItemComponentTypesBridge.bridge().suspiciousStewEffects();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2514,7 +2542,7 @@ index 0000000000000000000000000000000000000000..481741cf6b25011b7b90626256566630
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Tool.java b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3288cc1935334930585e1e1a61b147d86b8c88cf
|
||||
index 0000000000000000000000000000000000000000..f8ddf090b48f854461dfdc8e6faa9120254361e6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java
|
||||
@@ -0,0 +1,144 @@
|
||||
|
@ -2543,7 +2571,7 @@ index 0000000000000000000000000000000000000000..3288cc1935334930585e1e1a61b147d8
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static Tool.@NonNull Builder tool() {
|
||||
+ return ComponentTypesBridge.bridge().tool();
|
||||
+ return ItemComponentTypesBridge.bridge().tool();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2575,7 +2603,7 @@ index 0000000000000000000000000000000000000000..3288cc1935334930585e1e1a61b147d8
|
|||
+ interface Rule {
|
||||
+
|
||||
+ static @NonNull Rule rule(final @NonNull RegistryKeySet<BlockType> blocks, final @Nullable Float speed, final @NonNull TriState correctForDrops) {
|
||||
+ return ComponentTypesBridge.bridge().rule(blocks, speed, correctForDrops);
|
||||
+ return ItemComponentTypesBridge.bridge().rule(blocks, speed, correctForDrops);
|
||||
+ }
|
||||
+
|
||||
+ static @NonNull Rule minesAndDrops(final @NonNull RegistryKeySet<BlockType> blocks, final float speed) {
|
||||
|
@ -2664,7 +2692,7 @@ index 0000000000000000000000000000000000000000..3288cc1935334930585e1e1a61b147d8
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java b/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cd28d3d2bbb58320f034fd47d65c8cad1f6240db
|
||||
index 0000000000000000000000000000000000000000..a8ddecde35b427f594395a5df5420a20e85a3f5f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/Unbreakable.java
|
||||
@@ -0,0 +1,33 @@
|
||||
|
@ -2690,7 +2718,7 @@ index 0000000000000000000000000000000000000000..cd28d3d2bbb58320f034fd47d65c8cad
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static Unbreakable.@NonNull Builder unbreakable() {
|
||||
+ return ComponentTypesBridge.bridge().unbreakable();
|
||||
+ return ItemComponentTypesBridge.bridge().unbreakable();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2703,7 +2731,7 @@ index 0000000000000000000000000000000000000000..cd28d3d2bbb58320f034fd47d65c8cad
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cfe5671ae02bdee7d0b165c96e443a838ed91651
|
||||
index 0000000000000000000000000000000000000000..eb6042af2d5d0c63f1adc56576a4e6b80bb31463
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
|
@ -2728,7 +2756,7 @@ index 0000000000000000000000000000000000000000..cfe5671ae02bdee7d0b165c96e443a83
|
|||
+
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static WritableBookContent.@NonNull Builder writeableBookContent() {
|
||||
+ return ComponentTypesBridge.bridge().writeableBookContent();
|
||||
+ return ItemComponentTypesBridge.bridge().writeableBookContent();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -2789,7 +2817,7 @@ index 0000000000000000000000000000000000000000..cfe5671ae02bdee7d0b165c96e443a83
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9fadf5fc5f17e3595ba69fc23092eaeba0ef364a
|
||||
index 0000000000000000000000000000000000000000..a8f86b9ec871857106903715749bbbe4fd00cc29
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/WrittenBookContent.java
|
||||
@@ -0,0 +1,172 @@
|
||||
|
@ -2822,7 +2850,7 @@ index 0000000000000000000000000000000000000000..9fadf5fc5f17e3595ba69fc23092eaeb
|
|||
+
|
||||
+ @Contract(value = "_, _ -> new", pure = true)
|
||||
+ static WrittenBookContent.@NonNull Builder writtenBookContent(final @NonNull Filtered<@NonNull String> title, final @NonNull String author) {
|
||||
+ return ComponentTypesBridge.bridge().writtenBookContent(title, author);
|
||||
+ return ItemComponentTypesBridge.bridge().writtenBookContent(title, author);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
|
|
@ -397,11 +397,11 @@ index 0000000000000000000000000000000000000000..74e883d50477b3b4dabdcb674d95e92e
|
|||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridgesImpl.java
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..96f3c4287bdf791afd92d03149b8eabf06936297
|
||||
index 0000000000000000000000000000000000000000..10da83e8c871ba464e124ff011497d5de37b8d8a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ComponentTypesBridgesImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java
|
||||
@@ -0,0 +1,184 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
|
@ -420,7 +420,7 @@ index 0000000000000000000000000000000000000000..96f3c4287bdf791afd92d03149b8eabf
|
|||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class ComponentTypesBridgesImpl implements ComponentTypesBridge {
|
||||
+public final class ItemComponentTypesBridgesImpl implements ItemComponentTypesBridge {
|
||||
+
|
||||
+ @Override
|
||||
+ public ChargedProjectiles.Builder chargedProjectiles() {
|
||||
|
@ -1016,10 +1016,10 @@ index 0000000000000000000000000000000000000000..d61720f6316b2f7dee05fdb60640dbc6
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..350c8511d8e0a7e2f3ca45292f3d8415337a20f6
|
||||
index 0000000000000000000000000000000000000000..3a1e6dbc09794d9bc4aad53fb05ebd7810223ec9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperFoodProperties.java
|
||||
@@ -0,0 +1,155 @@
|
||||
@@ -0,0 +1,166 @@
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
|
@ -1079,6 +1079,17 @@ index 0000000000000000000000000000000000000000..350c8511d8e0a7e2f3ca45292f3d8415
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public FoodProperties.Builder toBuilder() {
|
||||
+ return new BuilderImpl()
|
||||
+ .addEffects(this.effects())
|
||||
+ .nutrition(this.nutrition())
|
||||
+ .saturation(this.saturation())
|
||||
+ .canAlwaysEat(this.canAlwaysEat())
|
||||
+ .eatSeconds(this.eatSeconds())
|
||||
+ .usingConvertsTo(this.usingConvertsTo());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.food.FoodProperties getHandle() {
|
||||
+ return this.impl;
|
||||
+ }
|
||||
|
@ -3265,11 +3276,11 @@ index 097996d3955ab5126b71f7bff1dd2c62becb5ffd..2e75620e803868ad3c254d11e6265062
|
|||
}
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ComponentTypesBridge b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ComponentTypesBridge
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1c1fcbbacc3881e088d64a7a840b3f3e31706c0f
|
||||
index 0000000000000000000000000000000000000000..0fd276c2fdbba784c1cd95105553996b4ba2460e
|
||||
--- /dev/null
|
||||
+++ b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ComponentTypesBridge
|
||||
@@ -0,0 +1 @@
|
||||
+io.papermc.paper.datacomponent.item.ComponentTypesBridgesImpl
|
||||
+io.papermc.paper.datacomponent.item.ItemComponentTypesBridgesImpl
|
||||
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..06476cdd7f8290846e86bdd3837488ca900a7ddc
|
||||
|
|
Loading…
Reference in a new issue