public class GameRules extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
GameRules.Acceptor<T extends GameRules.Rule<T>> |
static class |
GameRules.BooleanRule |
static class |
GameRules.Category |
static class |
GameRules.IntRule |
static class |
GameRules.Key<T extends GameRules.Rule<T>> |
static class |
GameRules.Rule<T extends GameRules.Rule<T>> |
static class |
GameRules.Type<T extends GameRules.Rule<T>> |
static interface |
GameRules.Visitor
A visitor used to visit all game rules.
|
Modifier | Constructor and Description |
---|---|
|
GameRules() |
|
GameRules(com.mojang.serialization.DynamicLike<?> dynamicLike) |
private |
GameRules(Map<GameRules.Key<?>,GameRules.Rule<?>> rules) |
Modifier and Type | Method and Description |
---|---|
static void |
accept(GameRules.Visitor visitor)
Make the visitor visit all registered game rules.
|
private static <T extends GameRules.Rule<T>> |
accept(GameRules.Visitor consumer,
GameRules.Key<?> key,
GameRules.Type<?> type) |
GameRules |
copy() |
<T extends GameRules.Rule<T>> |
get(GameRules.Key<T> key) |
boolean |
getBoolean(GameRules.Key<GameRules.BooleanRule> rule) |
int |
getInt(GameRules.Key<GameRules.IntRule> rule) |
private void |
load(com.mojang.serialization.DynamicLike<?> dynamicLike) |
private static <T extends GameRules.Rule<T>> |
register(String name,
GameRules.Category category,
GameRules.Type<T> type) |
void |
setAllValues(GameRules rules,
MinecraftServer server) |
private <T extends GameRules.Rule<T>> |
setValue(GameRules.Key<T> key,
GameRules rules,
MinecraftServer server) |
CompoundTag |
toNbt() |
private static final Logger LOGGER
private static final Map<GameRules.Key<?>,GameRules.Type<?>> RULE_TYPES
public static final GameRules.Key<GameRules.BooleanRule> DO_FIRE_TICK
public static final GameRules.Key<GameRules.BooleanRule> DO_MOB_GRIEFING
Generally one is expected to test this rule before an entity modifies the world.
In vanilla, this includes:
public static final GameRules.Key<GameRules.BooleanRule> KEEP_INVENTORY
public static final GameRules.Key<GameRules.BooleanRule> DO_MOB_SPAWNING
public static final GameRules.Key<GameRules.BooleanRule> DO_MOB_LOOT
public static final GameRules.Key<GameRules.BooleanRule> DO_TILE_DROPS
public static final GameRules.Key<GameRules.BooleanRule> DO_ENTITY_DROPS
public static final GameRules.Key<GameRules.BooleanRule> COMMAND_BLOCK_OUTPUT
public static final GameRules.Key<GameRules.BooleanRule> NATURAL_REGENERATION
public static final GameRules.Key<GameRules.BooleanRule> DO_DAYLIGHT_CYCLE
public static final GameRules.Key<GameRules.BooleanRule> LOG_ADMIN_COMMANDS
public static final GameRules.Key<GameRules.BooleanRule> SHOW_DEATH_MESSAGES
public static final GameRules.Key<GameRules.IntRule> RANDOM_TICK_SPEED
public static final GameRules.Key<GameRules.BooleanRule> SEND_COMMAND_FEEDBACK
public static final GameRules.Key<GameRules.BooleanRule> REDUCED_DEBUG_INFO
public static final GameRules.Key<GameRules.BooleanRule> SPECTATORS_GENERATE_CHUNKS
public static final GameRules.Key<GameRules.IntRule> SPAWN_RADIUS
public static final GameRules.Key<GameRules.BooleanRule> DISABLE_ELYTRA_MOVEMENT_CHECK
public static final GameRules.Key<GameRules.IntRule> MAX_ENTITY_CRAMMING
public static final GameRules.Key<GameRules.BooleanRule> DO_WEATHER_CYCLE
public static final GameRules.Key<GameRules.BooleanRule> DO_LIMITED_CRAFTING
public static final GameRules.Key<GameRules.IntRule> MAX_COMMAND_CHAIN_LENGTH
public static final GameRules.Key<GameRules.BooleanRule> ANNOUNCE_ADVANCEMENTS
public static final GameRules.Key<GameRules.BooleanRule> DISABLE_RAIDS
If this rule is set to true
while raids are occurring, the raids will be stopped.
public static final GameRules.Key<GameRules.BooleanRule> DO_INSOMNIA
public static final GameRules.Key<GameRules.BooleanRule> DO_IMMEDIATE_RESPAWN
public static final GameRules.Key<GameRules.BooleanRule> DROWNING_DAMAGE
public static final GameRules.Key<GameRules.BooleanRule> FALL_DAMAGE
public static final GameRules.Key<GameRules.BooleanRule> FIRE_DAMAGE
public static final GameRules.Key<GameRules.BooleanRule> DO_PATROL_SPAWNING
public static final GameRules.Key<GameRules.BooleanRule> DO_TRADER_SPAWNING
public static final GameRules.Key<GameRules.BooleanRule> FORGIVE_DEAD_PLAYERS
public static final GameRules.Key<GameRules.BooleanRule> UNIVERSAL_ANGER
private final Map<GameRules.Key<?>,GameRules.Rule<?>> rules
public GameRules(com.mojang.serialization.DynamicLike<?> dynamicLike)
public GameRules()
private GameRules(Map<GameRules.Key<?>,GameRules.Rule<?>> rules)
private static <T extends GameRules.Rule<T>> GameRules.Key<T> register(String name, GameRules.Category category, GameRules.Type<T> type)
public <T extends GameRules.Rule<T>> T get(GameRules.Key<T> key)
public CompoundTag toNbt()
private void load(com.mojang.serialization.DynamicLike<?> dynamicLike)
public GameRules copy()
public static void accept(GameRules.Visitor visitor)
The visitation involves calling both GameRules.Visitor.visit(GameRules.Key, GameRules.Type)
and visitX
for every game rule, where X is the current rule's concrete type such as a boolean.
private static <T extends GameRules.Rule<T>> void accept(GameRules.Visitor consumer, GameRules.Key<?> key, GameRules.Type<?> type)
@Environment(value=CLIENT) public void setAllValues(GameRules rules, @Nullable MinecraftServer server)
@Environment(value=CLIENT) private <T extends GameRules.Rule<T>> void setValue(GameRules.Key<T> key, GameRules rules, @Nullable MinecraftServer server)
public boolean getBoolean(GameRules.Key<GameRules.BooleanRule> rule)
public int getInt(GameRules.Key<GameRules.IntRule> rule)