Fix painting variant builder (#11660)

This commit is contained in:
Lulu13022002
2024-11-24 20:12:08 +01:00
parent bbe32f42f0
commit 8e2102c70b
6 changed files with 79 additions and 137 deletions

View File

@@ -3589,7 +3589,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ ConsumeEffect.ApplyStatusEffects applyStatusEffects(List<PotionEffect> effectList, float probability);
+
+ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet<PotionEffectType> potionEffectTypeTagKey);
+ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet<PotionEffectType> effectTypes);
+
+ ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects();
+

View File

@@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * sharpness enchantment.
+ *
+ * @param description the description component.
+ * @return this builder.
+ * @return this builder instance.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder description(Component description);
@@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * {@link io.papermc.paper.registry.keys.tags.ItemTypeTagKeys#ENCHANTABLE_SWORD}.
+ *
+ * @param supportedItems the registry key set representing the supported items.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * which enchantments can even show up in an enchantment table.
+ *
+ * @param primaryItems the registry key set representing the primary items.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@@ -223,7 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Configures the weight of this enchantment used by the weighted random when selecting enchantments.
+ *
+ * @param weight the weight value.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting">https://minecraft.wiki/w/Enchanting</a> for examplary weights.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@@ -233,7 +233,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Configures the maximum level this enchantment can have when applied.
+ *
+ * @param maxLevel the maximum level.
+ * @return this builder.
+ * @return this builder instance.
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder maxLevel(@Range(from = 1, to = 255) int maxLevel);
@@ -244,7 +244,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Note that a cost is not directly related to the consumed xp.
+ *
+ * @param minimumCost the enchantment cost.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
+ * examplary costs.
+ */
@@ -257,7 +257,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Note that a cost is not directly related to the consumed xp.
+ *
+ * @param maximumCost the enchantment cost.
+ * @return this builder.
+ * @return this builder instance.
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
+ * examplary costs.
+ */
@@ -272,7 +272,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * </p>
+ *
+ * @param anvilCost the anvil cost of this enchantment
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getAnvilCost()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@@ -285,7 +285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * groups, the enchantment's effects, like attribute modifiers, will not activate.
+ *
+ * @param activeSlots a list of equipment slot groups.
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getActiveSlotGroups()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * groups, the enchantment's effects, like attribute modifiers, will not activate.
+ *
+ * @param activeSlots a list of equipment slot groups.
+ * @return this builder.
+ * @return this builder instance.
+ * @see Enchantment#getActiveSlotGroups()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
@@ -315,7 +315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Defaults to an empty set allowing this enchantment to be applied regardless of other enchantments.
+ *
+ * @param exclusiveWith a registry set of enchantments exclusive to this one.
+ * @return this builder.
+ * @return this builder instance.
+ * @see RegistrySet#keySet(RegistryKey, TypedKey[])
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
+ */
@@ -358,7 +358,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return new Impl(baseCost, additionalPerLevelCost);
+ }
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/GameEventRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/GameEventRegistryEntry.java
new file mode 100644
@@ -443,27 +442,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+public interface PaintingVariantRegistryEntry {
+
+ /**
+ * Provides the width of this variant in blocks.
+ * Provides the width of this painting in blocks.
+ *
+ * @return the width
+ * @return the width.
+ * @see Art#getBlockWidth()
+ */
+ @Range(from = 1, to = 16)
+ int width();
+ @Range(from = 1, to = 16) int width();
+
+ /**
+ * Provides the height of this variant in blocks.
+ * Provides the height of this painting in blocks.
+ *
+ * @return the height
+ * @return the height.
+ * @see Art#getBlockHeight()
+ */
+ @Range(from = 1, to = 16)
+ int height();
+ @Range(from = 1, to = 16) int height();
+
+ /**
+ * Provides the title of the painting visible in the creative inventory.
+ *
+ * @return the title
+ * @return the title.
+ * @see Art#title()
+ */
+ @Nullable Component title();
@@ -471,15 +468,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Provides the author of the painting visible in the creative inventory.
+ *
+ * @return the author
+ * @return the author.
+ * @see Art#author()
+ */
+ @Nullable Component author();
+
+ /**
+ * Provides the assetId of the variant, which is the location of the sprite to use.
+ * Provides the asset id of the painting, which is the location of the sprite to use.
+ *
+ * @return the asset id
+ * @return the asset id.
+ * @see Art#assetId()
+ */
+ Key assetId();
@@ -501,30 +498,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Sets the width of the painting in blocks.
+ *
+ * @param width the width in blocks
+ * @return this builder instance
+ * @param width the width in blocks.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#width()
+ * @see Art#getBlockWidth()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder width(@Range(from = 0, to = 16) int width);
+ Builder width(@Range(from = 1, to = 16) int width);
+
+ /**
+ * Sets the height of the painting in blocks.
+ *
+ * @param height the height in blocks
+ * @return this builder instance
+ * @param height the height in blocks.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#height()
+ * @see Art#getBlockHeight()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder height(@Range(from = 0, to = 16) int height);
+ Builder height(@Range(from = 1, to = 16) int height);
+
+ /**
+ * Sets the title of the painting.
+ *
+ * @param title the title
+ * @return this builder instance
+ * @param title the title.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#title()
+ * @see Art#title()
+ */
@@ -534,8 +531,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Sets the author of the painting.
+ *
+ * @param author the author
+ * @return this builder instance
+ * @param author the author.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#author()
+ * @see Art#author()
+ */
@@ -543,18 +540,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Builder author(@Nullable Component author);
+
+ /**
+ * Sets the assetId of the variant, which is the location of the sprite to use.
+ * Sets the asset id of the painting, which is the location of the sprite to use.
+ *
+ * @param assetId the asset id
+ * @return this builder instance
+ * @param assetId the asset id.
+ * @return this builder instance.
+ * @see PaintingVariantRegistryEntry#assetId()
+ * @see Art#assetId()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder assetId(Key assetId);
+
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/data/package-info.java b/src/main/java/io/papermc/paper/registry/data/package-info.java
new file mode 100644