Skip to content

Commit c1f5409

Browse files
Owen1212055kennytv
authored andcommitted
Some progress
1 parent 6aad880 commit c1f5409

13 files changed

+231
-139
lines changed

paper-api/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java

+52-9
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,35 @@
3939
import io.papermc.paper.datacomponent.item.WrittenBookContent;
4040
import io.papermc.paper.item.MapPostProcessing;
4141
import java.util.List;
42+
import io.papermc.paper.registry.tag.TagKey;
4243
import net.kyori.adventure.key.Key;
4344
import net.kyori.adventure.text.Component;
45+
import org.bukkit.Art;
4446
import org.bukkit.DyeColor;
4547
import org.bukkit.FireworkEffect;
4648
import org.bukkit.MusicInstrument;
4749
import org.bukkit.NamespacedKey;
4850
import org.bukkit.Registry;
51+
import org.bukkit.block.banner.PatternType;
52+
import org.bukkit.entity.Axolotl;
53+
import org.bukkit.entity.Cat;
54+
import org.bukkit.entity.Chicken;
55+
import org.bukkit.entity.Cow;
56+
import org.bukkit.entity.Fox;
57+
import org.bukkit.entity.Frog;
58+
import org.bukkit.entity.Horse;
59+
import org.bukkit.entity.Llama;
60+
import org.bukkit.entity.MushroomCow;
61+
import org.bukkit.entity.Painting;
62+
import org.bukkit.entity.Parrot;
63+
import org.bukkit.entity.Pig;
64+
import org.bukkit.entity.Rabbit;
65+
import org.bukkit.entity.Salmon;
66+
import org.bukkit.entity.TropicalFish;
67+
import org.bukkit.entity.Villager;
68+
import org.bukkit.entity.Wolf;
4969
import org.bukkit.inventory.ItemRarity;
70+
import org.bukkit.inventory.meta.trim.TrimMaterial;
5071
import org.checkerframework.checker.index.qual.NonNegative;
5172
import org.checkerframework.checker.index.qual.Positive;
5273
import org.checkerframework.common.value.qual.IntRange;
@@ -144,15 +165,6 @@ public final class DataComponentTypes {
144165
* Controls the minecraft:custom_model_data property in the item model.
145166
*/
146167
public static final DataComponentType.Valued<CustomModelData> CUSTOM_MODEL_DATA = valued("custom_model_data");
147-
/**
148-
* If set, disables 'additional' tooltip part which comes from the item type
149-
* (e.g. content of a shulker).
150-
*/
151-
public static final DataComponentType.NonValued HIDE_ADDITIONAL_TOOLTIP = unvalued("hide_additional_tooltip");
152-
/**
153-
* If set, it will completely hide whole item tooltip (that includes item name).
154-
*/
155-
public static final DataComponentType.NonValued HIDE_TOOLTIP = unvalued("hide_tooltip");
156168
/**
157169
* The additional experience cost required to modify an item in an Anvil.
158170
* If not present, has an implicit default value of: {@code 0}.
@@ -243,6 +255,7 @@ public final class DataComponentTypes {
243255
* or potion applied to a Tipped Arrow.
244256
*/
245257
public static final DataComponentType.Valued<PotionContents> POTION_CONTENTS = valued("potion_contents");
258+
public static final DataComponentType.Valued<Float> POTION_DURATION_SCALE = valued("potion_duration_scale");
246259
/**
247260
* Holds the effects that will be applied when consuming Suspicious Stew.
248261
*/
@@ -267,11 +280,14 @@ public final class DataComponentTypes {
267280
* Holds the instrument type used by a Goat Horn.
268281
*/
269282
public static final DataComponentType.Valued<MusicInstrument> INSTRUMENT = valued("instrument");
283+
// this is a either holder, but due to legacy item loading
284+
public static final DataComponentType.Valued<TrimMaterial> PROVIDES_TRIM_MATERIAL = valued("provides_trim_material");
270285
/**
271286
* Controls the amplifier amount for an Ominous Bottle's Bad Omen effect.
272287
*/
273288
public static final DataComponentType.Valued<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = valued("ominous_bottle_amplifier");
274289
public static final DataComponentType.Valued<JukeboxPlayable> JUKEBOX_PLAYABLE = valued("jukebox_playable");
290+
public static final DataComponentType.Valued<TagKey<PatternType>> PROVIDES_BANNER_PATTERNS = valued("provides_banner_patterns");
275291
/**
276292
* List of recipes that should be unlocked when using the Knowledge Book item.
277293
*/
@@ -329,6 +345,33 @@ public final class DataComponentTypes {
329345
* Holds the unresolved loot table and seed of a container-like block.
330346
*/
331347
public static final DataComponentType.Valued<SeededContainerLoot> CONTAINER_LOOT = valued("container_loot");
348+
public static final DataComponentType.Valued<Key> BREAK_SOUND = valued("break_sound");
349+
public static final DataComponentType.Valued<Villager.Type> VILLAGER_VARIANT = valued("villager/variant");
350+
public static final DataComponentType.Valued<Wolf.Variant> WOLF_VARIANT = valued("wolf/variant");
351+
// public static final DataComponentType.Valued<Holder<WolfSoundVariant>> WOLF_SOUND_VARIANT = valued("wolf/sound_variant");
352+
public static final DataComponentType.Valued<DyeColor> WOLF_COLLAR = valued("wolf/collar");
353+
public static final DataComponentType.Valued<Fox.Type> FOX_VARIANT = valued("fox/variant");
354+
public static final DataComponentType.Valued<Salmon.Variant> SALMON_SIZE = valued("salmon/size");
355+
public static final DataComponentType.Valued<Parrot.Variant> PARROT_VARIANT = valued("parrot/variant");
356+
public static final DataComponentType.Valued<TropicalFish.Pattern> TROPICAL_FISH_PATTERN = valued("tropical_fish/pattern");
357+
public static final DataComponentType.Valued<DyeColor> TROPICAL_FISH_BASE_COLOR = valued("tropical_fish/base_color");
358+
public static final DataComponentType.Valued<DyeColor> TROPICAL_FISH_PATTERN_COLOR = valued("tropical_fish/pattern_color");
359+
public static final DataComponentType.Valued<MushroomCow.Variant> MOOSHROOM_VARIANT = valued("mooshroom/variant");
360+
public static final DataComponentType.Valued<Rabbit.Type> RABBIT_VARIANT = valued("rabbit/variant");
361+
public static final DataComponentType.Valued<Pig.Variant> PIG_VARIANT = valued("pig/variant");
362+
public static final DataComponentType.Valued<Cow.Variant> COW_VARIANT = valued("cow/variant");
363+
// TODO: This is a eitherholder? Why specifically the chicken?? Oh wait this is prolly for chicken egg cause legacy item loading
364+
public static final DataComponentType.Valued<Chicken.Variant> CHICKEN_VARIANT = valued("chicken/variant");
365+
public static final DataComponentType.Valued<Frog.Variant> FROG_VARIANT = valued("frog/variant");
366+
public static final DataComponentType.Valued<Horse.Style> HORSE_VARIANT = valued("horse/variant");
367+
public static final DataComponentType.Valued<Art> PAINTING_VARIANT = valued("painting/variant");
368+
public static final DataComponentType.Valued<Llama.Color> LLAMA_VARIANT = valued("llama/variant");
369+
public static final DataComponentType.Valued<Axolotl.Variant> AXOLOTL_VARIANT = valued("axolotl/variant");
370+
public static final DataComponentType.Valued<Cat.Type> CAT_VARIANT = valued("cat/variant");
371+
public static final DataComponentType.Valued<DyeColor> CAT_COLLAR = valued("cat/collar");
372+
public static final DataComponentType.Valued<DyeColor> SHEEP_COLOR = valued("sheep/color");
373+
public static final DataComponentType.Valued<DyeColor> SHULKER_COLOR = valued("shulker/color");
374+
332375

333376
private static DataComponentType.NonValued unvalued(final String name) {
334377
return (DataComponentType.NonValued) requireNonNull(Registry.DATA_COMPONENT_TYPE.get(NamespacedKey.minecraft(name)), name + " unvalued data component type couldn't be found, this is a bug.");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package io.papermc.paper.datacomponent.item;
2+
3+
import io.papermc.paper.datacomponent.DataComponentBuilder;
4+
import io.papermc.paper.registry.tag.TagKey;
5+
import net.kyori.adventure.key.Key;
6+
import org.bukkit.damage.DamageType;
7+
import org.jetbrains.annotations.ApiStatus;
8+
import org.jetbrains.annotations.Contract;
9+
import org.jetbrains.annotations.Nullable;
10+
11+
public interface BlocksAttacks {
12+
13+
@Contract(value = "-> new", pure = true)
14+
static Builder blocksAttacks() {
15+
}
16+
17+
float blockDelaySeconds();
18+
19+
float disableCooldownScale();
20+
21+
List<DamageReduction> damageReductions();
22+
23+
ItemDamageFunction itemDamage();
24+
25+
@Nullable
26+
TagKey<DamageType> bypassedBy();
27+
28+
@Nullable
29+
TagKey<DamageType> blockSound();
30+
31+
@Nullable
32+
TagKey<DamageType> disableSound();
33+
34+
/**
35+
* Builder for {@link BlocksAttacks}.
36+
*/
37+
@ApiStatus.Experimental
38+
@ApiStatus.NonExtendable
39+
interface Builder extends DataComponentBuilder<BlocksAttacks> {
40+
41+
@Contract(value = "_ -> this", mutates = "this")
42+
Builder blockDelaySeconds(float delay);
43+
44+
@Contract(value = "_ -> this", mutates = "this")
45+
Builder disableCooldownScale(float scale);
46+
47+
@Contract(value = "_ -> this", mutates = "this")
48+
Builder addDamageReduction(DamageReduction reduction);
49+
50+
@Contract(value = "_ -> this", mutates = "this")
51+
Builder damageReductions(List<DamageReduction> reductions);
52+
53+
@Contract(value = "_ -> this", mutates = "this")
54+
Builder itemDamage(ItemDamageFunction function);
55+
56+
@Contract(value = "_ -> this", mutates = "this")
57+
Builder bypassedBy(@Nullable TagKey<DamageType> bypassedBy);
58+
59+
@Contract(value = "_ -> this", mutates = "this")
60+
Builder blockSound(@Nullable Key sound);
61+
62+
@Contract(value = "_ -> this", mutates = "this")
63+
Builder disableSound(@Nullable Key sound);
64+
65+
}
66+
}

paper-api/src/main/java/io/papermc/paper/datacomponent/item/DyedItemColor.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
@NullMarked
1414
@ApiStatus.Experimental
1515
@ApiStatus.NonExtendable
16-
public interface DyedItemColor extends ShownInTooltip<DyedItemColor> {
16+
public interface DyedItemColor {
1717

1818
@Contract(value = "_, _ -> new", pure = true)
19-
static DyedItemColor dyedItemColor(final Color color, final boolean showInTooltip) {
20-
return dyedItemColor().color(color).showInTooltip(showInTooltip).build();
19+
static DyedItemColor dyedItemColor(final Color color) {
20+
return dyedItemColor().color(color).build();
2121
}
2222

2323
@Contract(value = "-> new", pure = true)
@@ -38,7 +38,7 @@ static DyedItemColor.Builder dyedItemColor() {
3838
*/
3939
@ApiStatus.Experimental
4040
@ApiStatus.NonExtendable
41-
interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<DyedItemColor> {
41+
interface Builder extends DataComponentBuilder<DyedItemColor> {
4242

4343
/**
4444
* Sets the color of this builder.

paper-api/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.papermc.paper.datacomponent.item;
22

33
import io.papermc.paper.block.BlockPredicate;
4+
import io.papermc.paper.datacomponent.BuildableDataComponent;
45
import io.papermc.paper.datacomponent.DataComponentBuilder;
56
import java.util.List;
67
import org.jetbrains.annotations.ApiStatus;
@@ -16,7 +17,7 @@
1617
@NullMarked
1718
@ApiStatus.Experimental
1819
@ApiStatus.NonExtendable
19-
public interface ItemAdventurePredicate extends ShownInTooltip<ItemAdventurePredicate> {
20+
public interface ItemAdventurePredicate {
2021

2122
@Contract(value = "_ -> new", pure = true)
2223
static ItemAdventurePredicate itemAdventurePredicate(final List<BlockPredicate> predicates) {
@@ -41,7 +42,7 @@ static ItemAdventurePredicate.Builder itemAdventurePredicate() {
4142
*/
4243
@ApiStatus.Experimental
4344
@ApiStatus.NonExtendable
44-
interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<ItemAdventurePredicate> {
45+
interface Builder extends DataComponentBuilder<ItemAdventurePredicate> {
4546
/**
4647
* Adds a block predicate to this builder.
4748
*

paper-api/src/main/java/io/papermc/paper/datacomponent/item/ItemArmorTrim.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313
@NullMarked
1414
@ApiStatus.Experimental
1515
@ApiStatus.NonExtendable
16-
public interface ItemArmorTrim extends ShownInTooltip<ItemArmorTrim> {
17-
18-
@Contract(value = "_, _ -> new", pure = true)
19-
static ItemArmorTrim itemArmorTrim(final ArmorTrim armorTrim, final boolean showInTooltip) {
20-
return itemArmorTrim(armorTrim).showInTooltip(showInTooltip).build();
21-
}
16+
public interface ItemArmorTrim {
2217

2318
@Contract(value = "_ -> new", pure = true)
2419
static ItemArmorTrim.Builder itemArmorTrim(final ArmorTrim armorTrim) {
@@ -38,7 +33,7 @@ static ItemArmorTrim.Builder itemArmorTrim(final ArmorTrim armorTrim) {
3833
*/
3934
@ApiStatus.Experimental
4035
@ApiStatus.NonExtendable
41-
interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<ItemArmorTrim> {
36+
interface Builder extends DataComponentBuilder<ItemArmorTrim> {
4237

4338
/**
4439
* Sets the armor trim for this builder.

paper-api/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@NullMarked
1818
@ApiStatus.Experimental
1919
@ApiStatus.NonExtendable
20-
public interface ItemAttributeModifiers extends ShownInTooltip<ItemAttributeModifiers> {
20+
public interface ItemAttributeModifiers {
2121

2222
@Contract(value = "-> new", pure = true)
2323
static ItemAttributeModifiers.Builder itemAttributes() {
@@ -69,7 +69,7 @@ default EquipmentSlotGroup getGroup() {
6969
*/
7070
@ApiStatus.Experimental
7171
@ApiStatus.NonExtendable
72-
interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<ItemAttributeModifiers> {
72+
interface Builder extends DataComponentBuilder<ItemAttributeModifiers> {
7373

7474
/**
7575
* Adds a modifier to this builder.

paper-api/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
@NullMarked
1818
@ApiStatus.Experimental
1919
@ApiStatus.NonExtendable
20-
public interface ItemEnchantments extends ShownInTooltip<ItemEnchantments> {
20+
public interface ItemEnchantments {
2121

2222
@Contract(value = "_, _ -> new", pure = true)
23-
static ItemEnchantments itemEnchantments(final Map<Enchantment, @IntRange(from = 1, to = 255) Integer> enchantments, final boolean showInTooltip) {
24-
return itemEnchantments().addAll(enchantments).showInTooltip(showInTooltip).build();
23+
static ItemEnchantments itemEnchantments(final Map<Enchantment, @IntRange(from = 1, to = 255) Integer> enchantments) {
24+
return itemEnchantments().addAll(enchantments).build();
2525
}
2626

2727
@Contract(value = "-> new", pure = true)
@@ -42,7 +42,7 @@ static ItemEnchantments.Builder itemEnchantments() {
4242
*/
4343
@ApiStatus.Experimental
4444
@ApiStatus.NonExtendable
45-
interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<ItemEnchantments> {
45+
interface Builder extends DataComponentBuilder<ItemEnchantments> {
4646

4747
/**
4848
* Adds an enchantment with the given level to this component.

paper-api/src/main/java/io/papermc/paper/datacomponent/item/JukeboxPlayable.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@NullMarked
1414
@ApiStatus.Experimental
1515
@ApiStatus.NonExtendable
16-
public interface JukeboxPlayable extends ShownInTooltip<JukeboxPlayable> {
16+
public interface JukeboxPlayable {
1717

1818
@Contract(value = "_ -> new", pure = true)
1919
static JukeboxPlayable.Builder jukeboxPlayable(final JukeboxSong song) {
@@ -28,7 +28,7 @@ static JukeboxPlayable.Builder jukeboxPlayable(final JukeboxSong song) {
2828
*/
2929
@ApiStatus.Experimental
3030
@ApiStatus.NonExtendable
31-
interface Builder extends ShownInTooltip.Builder<JukeboxPlayable.Builder>, DataComponentBuilder<JukeboxPlayable> {
31+
interface Builder extends DataComponentBuilder<JukeboxPlayable> {
3232

3333
/**
3434
* Sets the jukebox song.

paper-api/src/main/java/io/papermc/paper/datacomponent/item/ShownInTooltip.java

-55
This file was deleted.

0 commit comments

Comments
 (0)