Juuxel il y a 4 ans
Parent
commit
3d3b8bb55e

+ 26 - 0
common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java

@@ -31,21 +31,47 @@ import java.util.function.BiConsumer;
 public final class GameRuleFactory {
     private GameRuleFactory() {}
 
+    /**
+     * Creates a boolean rule type.
+     *
+     * @param defaultValue the rule's default value
+     * @return the created type
+     */
     @ExpectPlatform
     public static GameRules.Type<GameRules.BooleanValue> createBooleanRule(boolean defaultValue) {
         throw new AssertionError();
     }
 
+    /**
+     * Creates a boolean rule type.
+     *
+     * @param defaultValue    the rule's default value
+     * @param changedCallback a callback that is called when the rule's value is changed
+     * @return the created type
+     */
     @ExpectPlatform
     public static GameRules.Type<GameRules.BooleanValue> createBooleanRule(boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changedCallback) {
         throw new AssertionError();
     }
 
+    /**
+     * Creates an integer rule type.
+     *
+     * @param defaultValue the rule's default value
+     * @return the created type
+     */
     @ExpectPlatform
     public static GameRules.Type<GameRules.IntegerValue> createIntRule(int defaultValue) {
         throw new AssertionError();
     }
 
+    /**
+     * Creates an integer rule type.
+     *
+     * @param defaultValue    the rule's default value
+     * @param changedCallback a callback that is called when the rule's value is changed
+     * @return the created type
+     */
     @ExpectPlatform
     public static GameRules.Type<GameRules.IntegerValue> createIntRule(int defaultValue, BiConsumer<MinecraftServer, GameRules.IntegerValue> changedCallback) {
         throw new AssertionError();

+ 9 - 0
common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java

@@ -28,6 +28,15 @@ import net.minecraft.world.level.GameRules;
 public final class GameRuleRegistry {
     private GameRuleRegistry() {}
 
+    /**
+     * Registers a game rule.
+     *
+     * @param name     the rule's name
+     * @param category the rule category
+     * @param type     the type of the rule
+     * @param <T> the type of the rule value
+     * @return a key for the registered rule
+     */
     @ExpectPlatform
     public static <T extends GameRules.Value<T>> GameRules.Key<T> register(String name, GameRules.Category category, GameRules.Type<T> type) {
         throw new AssertionError();