Add javadocs

This commit is contained in:
Juuxel
2021-01-27 15:17:13 +02:00
parent 6de010f71a
commit 3d3b8bb55e
2 changed files with 35 additions and 0 deletions

View File

@@ -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();

View File

@@ -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();