From 660700a1d335442405214e846451c03378202656 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 23 Sep 2024 15:03:52 -0700 Subject: [PATCH] make MenuType implement FeatureDependant --- patches/api/Add-FeatureFlag-API.patch | 13 +++++++++++++ .../Introduce-registry-entry-and-builders.patch | 5 +++++ patches/server/Add-FeatureFlag-API.patch | 14 +++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/patches/api/Add-FeatureFlag-API.patch b/patches/api/Add-FeatureFlag-API.patch index eb23dbdc9f..f051f260c4 100644 --- a/patches/api/Add-FeatureFlag-API.patch +++ b/patches/api/Add-FeatureFlag-API.patch @@ -313,6 +313,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean isEnabledByFeature(@NotNull World world); /** +diff --git a/src/main/java/org/bukkit/inventory/MenuType.java b/src/main/java/org/bukkit/inventory/MenuType.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/MenuType.java ++++ b/src/main/java/org/bukkit/inventory/MenuType.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + * created and viewed by the player. + */ + @ApiStatus.Experimental +-public interface MenuType extends Keyed { ++public interface MenuType extends Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - make FeatureDependant + + /** + * A MenuType which represents a chest with 1 row. diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java diff --git a/patches/api/Introduce-registry-entry-and-builders.patch b/patches/api/Introduce-registry-entry-and-builders.patch index cc6749ac03..4635f34142 100644 --- a/patches/api/Introduce-registry-entry-and-builders.patch +++ b/patches/api/Introduce-registry-entry-and-builders.patch @@ -370,12 +370,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import io.papermc.paper.registry.RegistryBuilder; +import org.bukkit.GameEvent; +import org.checkerframework.checker.nullness.qual.NonNull; ++import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.Range; + +/** + * A data-centric version-specific registry entry for the {@link GameEvent} type. + */ ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable +public interface GameEventRegistryEntry { + + /** @@ -394,6 +397,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *
  • {@link #range(int)}
  • + * + */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable + interface Builder extends GameEventRegistryEntry, RegistryBuilder { + + /** diff --git a/patches/server/Add-FeatureFlag-API.patch b/patches/server/Add-FeatureFlag-API.patch index 6e1d529acc..7e1b2de64f 100644 --- a/patches/server/Add-FeatureFlag-API.patch +++ b/patches/server/Add-FeatureFlag-API.patch @@ -233,6 +233,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final NamespacedKey key; private final Item item; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java +@@ -0,0 +0,0 @@ import org.bukkit.entity.HumanEntity; + import org.bukkit.inventory.InventoryView; + import org.bukkit.inventory.MenuType; + +-public class CraftMenuType implements MenuType.Typed, Handleable> { ++public class CraftMenuType implements MenuType.Typed, Handleable>, io.papermc.paper.world.flag.PaperFeatureDependent { // Paper - make FeatureDependant + + private final NamespacedKey key; + private final net.minecraft.world.inventory.MenuType handle; diff --git a/src/main/java/org/bukkit/craftbukkit/packs/CraftDataPack.java b/src/main/java/org/bukkit/craftbukkit/packs/CraftDataPack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/packs/CraftDataPack.java @@ -380,7 +393,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + static Set> featureFilteredRegistries() { + final Set> registryKeys = new HashSet<>(); + for (final ResourceKey filteredRegistry : FeatureElement.FILTERED_REGISTRIES) { -+ if (filteredRegistry == Registries.MENU) continue; // not applicable atm + registryKeys.add(PaperRegistries.registryFromNms(filteredRegistry)); + } + return registryKeys;