bunch more general fixes

This commit is contained in:
Jake Potrebic 2024-10-31 20:35:06 -07:00
parent 1de01302d4
commit 16d7d73bd5
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
13 changed files with 504 additions and 40 deletions

View file

@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96f150c49a
index 0000000000000000000000000000000000000000..fdef87eec3765523b00c987d4c1ccc289882e95d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
@@ -0,0 +1,179 @@
@@ -0,0 +1,188 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Keyed;
@ -204,6 +204,17 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
+ * @see io.papermc.paper.registry.keys.MenuTypeKeys
+ */
+ RegistryKey<MenuType> MENU = create("menu");
+ /**
+ * Built-in registry for attributes.
+ * @see io.papermc.paper.registry.keys.AttributeKeys
+ */
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
+ /**
+ * Built-in registry for fluids.
+ * @see io.papermc.paper.registry.keys.FluidKeys
+ */
+ RegistryKey<Fluid> FLUID = create("fluid");
+
+
+
+ /* ********************** *
@ -260,13 +271,11 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
+ * API-only Registries *
+ * ******************* */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
+ RegistryKey<PotionType> POTION = create("potion");
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
+ RegistryKey<Fluid> FLUID = create("fluid");
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
new file mode 100644

View file

@ -441,3 +441,18 @@ index bc3440eb72127824b3961fbdae583bb61385f65e..17b33f8e6e3dc6a22686a498fa944382
return (StonecuttingRecipe) this;
}
diff --git a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java
index 5a8616792ade898c702daf471a2511c0f467df5c..8484b045ce4bf5292cda7d512c5ee3a86480049b 100644
--- a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java
+++ b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java
@@ -26,8 +26,8 @@ public class TransmuteRecipe extends CraftingRecipe implements ComplexRecipe {
*/
public TransmuteRecipe(@NotNull NamespacedKey key, @NotNull Material result, @NotNull RecipeChoice input, @NotNull RecipeChoice material) {
super(key, checkResult(new ItemStack(result)));
- this.input = input;
- this.material = material;
+ this.input = input.validate(false).clone(); // Paper
+ this.material = material.validate(false).clone(); // Paper
}
/**

View file

@ -112,9 +112,18 @@ index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc01
* Checks to see if this item has a maximum amount of damage.
*
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index afdcc2d67d55f2f07c913816e1f5b290d1415357..fc089b796f5a0f2e1ab081cc710e4bb5c3f5ee7b 100644
index afdcc2d67d55f2f07c913816e1f5b290d1415357..3fdba38fd5e75ddcbfca9cee70a606bfa4a539bf 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -328,7 +328,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
/**
* Sets the enchantable. Higher values allow higher enchantments.
*
- * @param enchantable enchantable value
+ * @param enchantable enchantable value, must be positive
*/
void setEnchantable(@Nullable Integer enchantable);
@@ -877,8 +877,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
/**

View file

@ -4,6 +4,81 @@ Date: Sat, 7 Sep 2024 11:14:31 -0700
Subject: [PATCH] Deprecate for removal all OldEnum-related methods
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
index dff295a4ca877b172f04c60de734c1551afdb5a7..a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df 100644
--- a/src/main/java/org/bukkit/Fluid.java
+++ b/src/main/java/org/bukkit/Fluid.java
@@ -43,7 +43,7 @@ public interface Fluid extends OldEnum<Fluid>, Keyed {
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Fluid valueOf(@NotNull String name) {
Fluid fluid = Bukkit.getUnsafe().get(Registry.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(fluid != null, "No fluid found with the name %s", name);
@@ -55,7 +55,7 @@ public interface Fluid extends OldEnum<Fluid>, Keyed {
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Fluid[] values() {
return Lists.newArrayList(Registry.FLUID).toArray(new Fluid[0]);
}
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
index 21f9998b472dc18eb308554f5cdf467f6675f2f0..521f035409ee61a9ad73d39bec938f2938892570 100644
--- a/src/main/java/org/bukkit/attribute/Attribute.java
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
@@ -156,7 +156,7 @@ public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Attribute valueOf(@NotNull String name) {
Attribute attribute = Bukkit.getUnsafe().get(Registry.ATTRIBUTE, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(attribute != null, "No attribute found with the name %s", name);
@@ -168,7 +168,7 @@ public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Attribute[] values() {
return Lists.newArrayList(Registry.ATTRIBUTE).toArray(new Attribute[0]);
}
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
index b352886e697a1c9869226b583da5240592575064..464f8f81ba907a61588e4ab869e4f8269830195a 100644
--- a/src/main/java/org/bukkit/block/Biome.java
+++ b/src/main/java/org/bukkit/block/Biome.java
@@ -97,7 +97,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
*
* @deprecated Biome is no longer an enum, custom biomes will have their own biome instance.
*/
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
Biome CUSTOM = Bukkit.getUnsafe().getCustomBiome();
@NotNull
@@ -111,7 +111,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Biome valueOf(@NotNull String name) {
if ("CUSTOM".equals(name)) {
return Biome.CUSTOM;
@@ -127,7 +127,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull
- @Deprecated(since = "1.21.3")
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Biome[] values() {
return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
}
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
index eb192030832e1741850871bec9bf999f014b6fc1..70904d6c43b93cb7b9d74d20666fac93a6b4996c 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java