diff --git a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch index 5378975da..0ef93c5f2 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch @@ -225,12 +225,8 @@ final String id; private final GameRules.Category category; -@@ -572,10 +_,10 @@ - } - } - -- public static class Type> { -+ public static class Type> implements net.minecraft.world.flag.FeatureElement { // Paper - FeatureDependant for GameRule +@@ -575,7 +_,7 @@ + public static class Type> { final Supplier> argument; private final Function, T> constructor; - final BiConsumer callback; @@ -247,6 +243,19 @@ GameRules.VisitorCaller visitorCaller, Class valueClass, FeatureFlagSet requiredFeatures +@@ -611,6 +_,12 @@ + public FeatureFlagSet requiredFeatures() { + return this.requiredFeatures; + } ++ // Paper start - expose FeatureElement wrapper for GameRules.Type. ++ // Chosen over simply adding this to the inheritance to avoid reobf issues with spigot... ++ public net.minecraft.world.flag.FeatureElement asFeatureElement() { ++ return net.minecraft.world.level.GameRules.Type.this::requiredFeatures; ++ } ++ // Paper end - expose FeatureElement wrapper for GameRules.Type. + } + + public abstract static class Value> { @@ -620,16 +_,16 @@ this.type = type; } diff --git a/paper-server/src/main/java/io/papermc/paper/world/flag/PaperFeatureFlagProviderImpl.java b/paper-server/src/main/java/io/papermc/paper/world/flag/PaperFeatureFlagProviderImpl.java index 207a67d99..58ba269c5 100644 --- a/paper-server/src/main/java/io/papermc/paper/world/flag/PaperFeatureFlagProviderImpl.java +++ b/paper-server/src/main/java/io/papermc/paper/world/flag/PaperFeatureFlagProviderImpl.java @@ -52,7 +52,7 @@ public class PaperFeatureFlagProviderImpl implements FeatureFlagProvider { } else if (dependant instanceof final PotionType potionType) { return CraftPotionType.bukkitToMinecraft(potionType); } else if (dependant instanceof final GameRule gameRule) { - return getGameRuleType(gameRule.getName()); + return getGameRuleType(gameRule.getName()).asFeatureElement(); } else { throw new IllegalArgumentException(dependant + " is not a valid feature dependant"); }