make MenuType implement FeatureDependant

This commit is contained in:
Jake Potrebic 2024-09-23 15:03:52 -07:00
parent 4514c71a7f
commit acdd6d35ad
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
3 changed files with 35 additions and 5 deletions

View File

@ -361,21 +361,24 @@ index 0000000000000000000000000000000000000000..6c7d8b98103909428bb4dcf14825fe18
+}
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
index 0000000000000000000000000000000000000000..27b4da08168c7b341b776635011ff4022a12d361
index 0000000000000000000000000000000000000000..a59620816f8795fc0e585f969741d1940340673a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/data/GameEventRegistryEntry.java
@@ -0,0 +1,43 @@
@@ -0,0 +1,48 @@
+package io.papermc.paper.registry.data;
+
+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..27b4da08168c7b341b776635011ff402
+ * <li>{@link #range(int)}</li>
+ * </ul>
+ */
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface Builder extends GameEventRegistryEntry, RegistryBuilder<GameEvent> {
+
+ /**

View File

@ -313,6 +313,19 @@ index 0168f0a14a3e899e84c5e36963ff79950ab580fb..5b4449f63595193efcd1329b9df0558c
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 29dfad691cbdd09d043f6171defc8a7fabbc2b75..5ddc24df90c3a4b9f92a49437e1aa90e3961daf3 100644
--- a/src/main/java/org/bukkit/inventory/MenuType.java
+++ b/src/main/java/org/bukkit/inventory/MenuType.java
@@ -23,7 +23,7 @@ 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 10fa51d116b40450b51af9110d5637f3505ebf65..647452f16e4bf7e5a61520123e62d9408ec9adfb 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java

View File

@ -233,6 +233,19 @@ index 450c63c31d2f5d056d989aa00452231f50c8224d..b9d9f1df2720c301915c8b07c0bdc129
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 d658634ea4468c9dbfb29bc12282441c96358566..fbde94b72063da69cc1a1f7934e069c6c8c0f804 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMenuType.java
@@ -18,7 +18,7 @@ import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.MenuType;
-public class CraftMenuType<V extends InventoryView> implements MenuType.Typed<V>, Handleable<net.minecraft.world.inventory.MenuType<?>> {
+public class CraftMenuType<V extends InventoryView> implements MenuType.Typed<V>, Handleable<net.minecraft.world.inventory.MenuType<?>>, 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 9525a7d4602b9b98dcc5e5e60dbcb628a656ae53..a0c0ad832726dcf9c8c25c1cfce2a6ddf770bf0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/packs/CraftDataPack.java
@ -310,10 +323,10 @@ index 0000000000000000000000000000000000000000..c3e6b96013f6dd0b784bd867196552d9
+io.papermc.paper.world.flag.PaperFeatureFlagProviderImpl
diff --git a/src/test/java/io/papermc/paper/world/flag/FeatureFlagTest.java b/src/test/java/io/papermc/paper/world/flag/FeatureFlagTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..1fd830b148468e1db84e0e27d54c4fd6449fa9d8
index 0000000000000000000000000000000000000000..4817040741de8b0e12c96994f59b58681c09852d
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/flag/FeatureFlagTest.java
@@ -0,0 +1,99 @@
@@ -0,0 +1,98 @@
+package io.papermc.paper.world.flag;
+
+import io.papermc.paper.adventure.PaperAdventure;
@ -380,7 +393,6 @@ index 0000000000000000000000000000000000000000..1fd830b148468e1db84e0e27d54c4fd6
+ static Set<RegistryKey<?>> featureFilteredRegistries() {
+ final Set<RegistryKey<?>> 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;