From 6ce622daf1bc9b9347fb071835a7a4aaa8ce6e3d Mon Sep 17 00:00:00 2001 From: ImMorpheus Date: Mon, 6 Nov 2023 00:36:32 +0100 Subject: [PATCH] Add GameRules generator --- .../api/world/gamerule/GameRules.java | 302 ++---------------- 1 file changed, 24 insertions(+), 278 deletions(-) diff --git a/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java b/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java index a474288e6a..7a382dd342 100644 --- a/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java +++ b/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java @@ -26,31 +26,6 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; -import org.spongepowered.api.block.BlockTypes; -import org.spongepowered.api.block.entity.CommandBlock; -import org.spongepowered.api.entity.living.Agent; -import org.spongepowered.api.entity.living.Bat; -import org.spongepowered.api.entity.living.animal.Rabbit; -import org.spongepowered.api.entity.living.animal.Sheep; -import org.spongepowered.api.entity.living.golem.SnowGolem; -import org.spongepowered.api.entity.living.monster.Creeper; -import org.spongepowered.api.entity.living.monster.Enderman; -import org.spongepowered.api.entity.living.monster.Ghast; -import org.spongepowered.api.entity.living.monster.Patroller; -import org.spongepowered.api.entity.living.monster.Phantom; -import org.spongepowered.api.entity.living.monster.Silverfish; -import org.spongepowered.api.entity.living.monster.boss.Wither; -import org.spongepowered.api.entity.living.monster.boss.dragon.EnderDragon; -import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; -import org.spongepowered.api.entity.living.monster.zombie.Zombie; -import org.spongepowered.api.entity.living.monster.zombie.ZombifiedPiglin; -import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.entity.living.player.gamemode.GameModes; -import org.spongepowered.api.entity.living.trader.Villager; -import org.spongepowered.api.entity.living.trader.WanderingTrader; -import org.spongepowered.api.entity.vehicle.Boat; -import org.spongepowered.api.entity.vehicle.minecart.MinecartLike; -import org.spongepowered.api.raid.Raid; import org.spongepowered.api.registry.DefaultedRegistryReference; import org.spongepowered.api.registry.Registry; import org.spongepowered.api.registry.RegistryKey; @@ -66,330 +41,101 @@ public final class GameRules { // @formatter:off - // SORTFIELDS:ON - - /** - * If advancements should be announced to the server. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> ANNOUNCE_ADVANCEMENTS = GameRules.key(ResourceKey.sponge("announce_advancements")); - /** - * Whether {@link CommandBlock}s should notify admins when - * they perform commands. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ + public static final DefaultedRegistryReference> BLOCK_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("block_explosion_drop_decay")); + public static final DefaultedRegistryReference> COMMAND_BLOCK_OUTPUT = GameRules.key(ResourceKey.sponge("command_block_output")); - /** - * Whether the server should skip checking player speed when - * the player is wearing elytra. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ + public static final DefaultedRegistryReference> COMMAND_MODIFICATION_BLOCK_LIMIT = GameRules.key(ResourceKey.sponge("command_modification_block_limit")); + public static final DefaultedRegistryReference> DISABLE_ELYTRA_MOVEMENT_CHECK = GameRules.key(ResourceKey.sponge("disable_elytra_movement_check")); - /** - * Whether {@link Raid}s are disabled. - * - *

If the value of this game rule is {@code true}, all {@link Raid}s will stop. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ public static final DefaultedRegistryReference> DISABLE_RAIDS = GameRules.key(ResourceKey.sponge("disable_raids")); - /** - * Whether the day-night cycle and moon phases progress. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> DO_DAYLIGHT_CYCLE = GameRules.key(ResourceKey.sponge("do_daylight_cycle")); - /** - * Whether entities that are not mobs should have drops. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> DO_ENTITY_DROPS = GameRules.key(ResourceKey.sponge("do_entity_drops")); - /** - * Whether fire should spread and naturally extinguish. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> DO_FIRE_TICK = GameRules.key(ResourceKey.sponge("do_fire_tick")); - /** - * Whether {@link Phantom}s can spawn in the night-time. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ - public static final DefaultedRegistryReference> DO_INSOMNIA = GameRules.key(ResourceKey.sponge("do_insomnia")); - - /** - * Whether {@link Player}s should respawn immediately without showing the death screen. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> DO_IMMEDIATE_RESPAWN = GameRules.key(ResourceKey.sponge("do_immediate_respawn")); - /** - * Whether {@link Player}s can only craft recipes they have unlocked. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ + public static final DefaultedRegistryReference> DO_INSOMNIA = GameRules.key(ResourceKey.sponge("do_insomnia")); + public static final DefaultedRegistryReference> DO_LIMITED_CRAFTING = GameRules.key(ResourceKey.sponge("do_limited_crafting")); - /** - * Whether {@link Agent}s should drop items. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> DO_MOB_LOOT = GameRules.key(ResourceKey.sponge("do_mob_loot")); - /** - * Whether {@link Agent}s should naturally spawn. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> DO_MOB_SPAWNING = GameRules.key(ResourceKey.sponge("do_mob_spawning")); - /** - * Whether {@link Patroller patrollers} will go out on patrol (typically in a {@link Raid}. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> DO_PATROL_SPAWNING = GameRules.key(ResourceKey.sponge("do_patrol_spawning")); - /** - * Whether blocks should have drops. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> DO_TILE_DROPS = GameRules.key(ResourceKey.sponge("do_tile_drops")); - /** - * Whether {@link WanderingTrader traders} will naturally spawn. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> DO_TRADER_SPAWNING = GameRules.key(ResourceKey.sponge("do_trader_spawning")); - /** - * Whether the weather will change. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ + public static final DefaultedRegistryReference> DO_VINES_SPREAD = GameRules.key(ResourceKey.sponge("do_vines_spread")); + + public static final DefaultedRegistryReference> DO_WARDEN_SPAWNING = GameRules.key(ResourceKey.sponge("do_warden_spawning")); + public static final DefaultedRegistryReference> DO_WEATHER_CYCLE = GameRules.key(ResourceKey.sponge("do_weather_cycle")); - /** - * Whether entities should take drowning damage. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> DROWNING_DAMAGE = GameRules.key(ResourceKey.sponge("drowning_damage")); - /** - * Whether entities should take fall damage. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ + public static final DefaultedRegistryReference> ENDER_PEARLS_VANISH_ON_DEATH = GameRules.key(ResourceKey.sponge("ender_pearls_vanish_on_death")); + public static final DefaultedRegistryReference> FALL_DAMAGE = GameRules.key(ResourceKey.sponge("fall_damage")); - /** - * Whether entities should take fire damage. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> FIRE_DAMAGE = GameRules.key(ResourceKey.sponge("fire_damage")); - /** - * Makes angered neutral mobs stop being angry when the targeted player dies nearby. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> FORGIVE_DEAD_PLAYERS = GameRules.key(ResourceKey.sponge("forgive_dead_players")); - /** - * Whether entities should take freeze damage. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ public static final DefaultedRegistryReference> FREEZE_DAMAGE = GameRules.key(ResourceKey.sponge("freeze_damage")); - /** - * Whether {@link Player}s should keep items in their inventory - * after death. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ + public static final DefaultedRegistryReference> GLOBAL_SOUND_EVENTS = GameRules.key(ResourceKey.sponge("global_sound_events")); + public static final DefaultedRegistryReference> KEEP_INVENTORY = GameRules.key(ResourceKey.sponge("keep_inventory")); - /** - * Whether to log admin commands to server log. - * - *

This is a boolean game rule, with a default value of - * {@code true}.

- */ + public static final DefaultedRegistryReference> LAVA_SOURCE_CONVERSION = GameRules.key(ResourceKey.sponge("lava_source_conversion")); + public static final DefaultedRegistryReference> LOG_ADMIN_COMMANDS = GameRules.key(ResourceKey.sponge("log_admin_commands")); - /** - * The total number of {@link BlockTypes#CHAIN_COMMAND_BLOCK chain command - * blocks} that can run during a single tick. - * - *

This is a numerical game rule, with a default value - * of {@code 65536}.

- */ public static final DefaultedRegistryReference> MAX_COMMAND_CHAIN_LENGTH = GameRules.key(ResourceKey.sponge("max_command_chain_length")); - /** - * The maximum number of other pushable entities a mob or player can push, - * before taking 3 suffocation damage per half-second. - * - *

Damage affects {@link GameModes#SURVIVAL survival mode} or - * {@link GameModes#ADVENTURE adventure mode} {@link Player}s, and all - * mobs but bats. Pushable entities include non-spectator-mode - * {@link Player}, any mob except {@link Bat}s, as well as - * {@link Boat}s and {@link MinecartLike}.

- * - *

Setting to {@code 0} disables the rule.

- * - *

This is a numerical game rule, with a default value of {@code 24}.

- */ public static final DefaultedRegistryReference> MAX_ENTITY_CRAMMING = GameRules.key(ResourceKey.sponge("max_entity_cramming")); - /** - * Whether {@link Agent}s should be able to change blocks, and whether - * {@link Agent}s can pick up items. - * - *

In vanilla Minecraft, the following entities can change blocks when - * this game rule is {@code true}: - *

    - *
  • {@link Creeper}
  • - *
  • {@link Zombie}
  • - *
  • {@link Enderman}
  • - *
  • {@link Ghast}
  • - *
  • {@link Wither}
  • - *
  • {@link EnderDragon}
  • - *
  • {@link Rabbit}
  • - *
  • {@link Sheep}
  • - *
  • {@link Villager}
  • - *
  • {@link SnowGolem}
  • - *
  • {@link Silverfish}
  • - *
- * - *

In vanilla Minecraft, the following entities can pick up items when - * this game rule is {@code true}: - *

    - *
  • {@link Villager}
  • - *
  • {@link Zombie}
  • - *
  • {@link Skeleton}
  • - *
  • {@link ZombifiedPiglin}
  • - *
- * - *

This is a boolean game rule, with a default value of {@code true}.

- */ + public static final DefaultedRegistryReference> MOB_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("mob_explosion_drop_decay")); + public static final DefaultedRegistryReference> MOB_GRIEFING = GameRules.key(ResourceKey.sponge("mob_griefing")); - /** - * Whether {@link Player}s can regenerate health naturally if their - * hunger is full enough (doesn't affect external healing, such as - * golden apples, the Regeneration effect, etc.). - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> NATURAL_REGENERATION = GameRules.key(ResourceKey.sponge("natural_regeneration")); - /** - * What percentage of players must sleep to skip the night. - * - *

This is a numerical game rule, with a default value of {@code 100}.

- */ public static final DefaultedRegistryReference> PLAYERS_SLEEPING_PERCENTAGE = GameRules.key(ResourceKey.sponge("players_sleeping_percentage")); - /** - * How often a random block tick occurs (such as plant growth, - * leaf decay, etc.) per chunk section per game tick. - * - *

0 will disable random ticks, higher numbers will increase random - * ticks

- * - *

This is a numerical game rule, with a default value of {@code 3}.

- */ public static final DefaultedRegistryReference> RANDOM_TICK_SPEED = GameRules.key(ResourceKey.sponge("random_tick_speed")); - /** - * Whether the debug screen shows all or reduced information. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ public static final DefaultedRegistryReference> REDUCED_DEBUG_INFO = GameRules.key(ResourceKey.sponge("reduced_debug_info")); - /** - * Whether the feedback from commands executed by a {@link Player} - * should show up in chat. - * - *

This game rule affects the default behavior of whether - * {@link CommandBlock}s store their output text.

- * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> SEND_COMMAND_FEEDBACK = GameRules.key(ResourceKey.sponge("send_command_feedback")); - /** - * Whether a message appears in chat when a {@link Player} dies. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> SHOW_DEATH_MESSAGES = GameRules.key(ResourceKey.sponge("show_death_messages")); - /** - * The number of blocks outward from the world spawn coordinates - * that a player will spawn in when first joining a server or when - * dying without a spawn point. - * - *

This is a numerical game rule, with a default value of {@code 10}.

- */ + public static final DefaultedRegistryReference> SNOW_ACCUMULATION_HEIGHT = GameRules.key(ResourceKey.sponge("snow_accumulation_height")); + public static final DefaultedRegistryReference> SPAWN_RADIUS = GameRules.key(ResourceKey.sponge("spawn_radius")); - /** - * Whether players in {@link GameModes#SPECTATOR spectator mode} can - * generate chunks. - * - *

This is a boolean game rule, with a default value of {@code true}.

- */ public static final DefaultedRegistryReference> SPECTATORS_GENERATE_CHUNKS = GameRules.key(ResourceKey.sponge("spectators_generate_chunks")); - /** - * Makes angered neutral mobs attack any nearby player, not just the player that angered them. - * - *

This is a boolean game rule, with a default value of - * {@code false}.

- */ + public static final DefaultedRegistryReference> TNT_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("tnt_explosion_drop_decay")); + public static final DefaultedRegistryReference> UNIVERSAL_ANGER = GameRules.key(ResourceKey.sponge("universal_anger")); - // SORTFIELDS:OFF + public static final DefaultedRegistryReference> WATER_SOURCE_CONVERSION = GameRules.key(ResourceKey.sponge("water_source_conversion")); + // SORTFIELDS:OFF // @formatter:on - private GameRules() { }