Package net.minecraft

Class SharedConstants

java.lang.Object
net.minecraft.SharedConstants

public class SharedConstants extends Object
Shared global constants.

Note: The majority of the fields within this class are public static final with constant expressions (constants), and are inlined by the Java compiler at all places which reference these constant fields. Therefore, changing the value of these constant fields will have no effect on already compiled code.

In addition, it is presumed that a large portion of these constant fields (such as those prefixed with DEBUG_ are used as 'flags', for manually toggling code meant for use by Mojang developers in debugging. Therefore, optimizing compilers (which include the Java compiler) may omit the code hidden behind disabled flags, and will result in these flags having no apparent use in the code (when in reality, the optimizing compiler has removed the code which uses them).

See Also:
  • Field Details

    • SNAPSHOT

      @Deprecated public static final boolean SNAPSHOT
      Deprecated.
      Use getCurrentVersion() and
      invalid reference
      com.mojang.bridge.game.GameVersion#isStable()
      instead.
      Indicates whether the currently running game version is a snapshot version.
      See Also:
    • WORLD_VERSION

      @Deprecated public static final int WORLD_VERSION
      Deprecated.
      Use getCurrentVersion() and
      invalid reference
      com.mojang.bridge.game.GameVersion#getWorldVersion()
      instead.
      The numeric format number for worlds used by this game version.
      See Also:
    • SERIES

      @Deprecated public static final String SERIES
      Deprecated.
      See Also:
    • VERSION_STRING

      @Deprecated public static final String VERSION_STRING
      Deprecated.
      Use getCurrentVersion() and
      invalid reference
      com.mojang.bridge.game.GameVersion#getName()
      instead.
      The human readable name of this game version.
      See Also:
    • RELEASE_NETWORK_PROTOCOL_VERSION

      @Deprecated public static final int RELEASE_NETWORK_PROTOCOL_VERSION
      Deprecated.
      The numeric format number for the networking protocol used by the release target of this game version.

      This protocol version is used when this game version is a release version, not a snapshots. For snapshots, see SNAPSHOT_NETWORK_PROTOCOL_VERSION.

      See Also:
    • SNAPSHOT_NETWORK_PROTOCOL_VERSION

      @Deprecated public static final int SNAPSHOT_NETWORK_PROTOCOL_VERSION
      Deprecated.
      The numeric format number for the networking protocol used by the snapshot of this game version.

      This protocol version is used when this game version is a snapshot version. For releases, see RELEASE_NETWORK_PROTOCOL_VERSION.

      The actual networking protocol version used in snapshot versions is the combination (bitwise OR) of this number and the bit at the position marked by SNAPSHOT_PROTOCOL_BIT.

      See Also:
    • SNBT_NAG_VERSION

      public static final int SNBT_NAG_VERSION
      See Also:
    • SNAPSHOT_PROTOCOL_BIT

      private static final int SNAPSHOT_PROTOCOL_BIT
      The bit in the networking protocol version for denoting snapshot versions.
      See Also:
    • CRASH_EAGERLY

      public static final boolean CRASH_EAGERLY
      See Also:
    • RESOURCE_PACK_FORMAT

      @Deprecated public static final int RESOURCE_PACK_FORMAT
      Deprecated.
      Use getCurrentVersion(),
      invalid @link
      {@link com.mojang.bridge.game.GameVersion#com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)
      }, and com.mojang.bridge.game.PackType#RESOURCE instead.
      The format of the resource packs used by this game version. Resource packs contain client-side assets, such as translation files, models, and textures.
      See Also:
      • invalid reference
        com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)
      • Constant Field Values
    • DATA_PACK_FORMAT

      @Deprecated public static final int DATA_PACK_FORMAT
      Deprecated.
      Use getCurrentVersion(),
      invalid @link
      {@link com.mojang.bridge.game.GameVersion#com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)
      }, and com.mojang.bridge.game.PackType#DATA instead.
      The format of the data packs used by this game version. Data packs contain server-side data such as recipes, loot tables, and tags.
      See Also:
      • invalid reference
        com.mojang.bridge.game.GameVersion#getPackVersion(com.mojang.bridge.game.PackType)
      • Constant Field Values
    • LANGUAGE_FORMAT

      @Deprecated public static final int LANGUAGE_FORMAT
      Deprecated.
      See Also:
    • REPORT_FORMAT_VERSION

      public static final int REPORT_FORMAT_VERSION
      See Also:
    • DATA_VERSION_TAG

      public static final String DATA_VERSION_TAG
      The key for the NBT tag which contains the data version of some data, for use in datafixing.

      For various objects, their stored data in a CompoundTag will usually contain a IntTag indexed with this key, which stores the data version when the data for that object was written out. This is used by the datafixer system to determine which fixers needs to be applied to the data.

      See Also:
    • FIX_TNT_DUPE

      public static final boolean FIX_TNT_DUPE
      See Also:
    • FIX_SAND_DUPE

      public static final boolean FIX_SAND_DUPE
      See Also:
    • USE_DEBUG_FEATURES

      public static final boolean USE_DEBUG_FEATURES
      See Also:
    • DEBUG_OPEN_INCOMPATIBLE_WORLDS

      public static final boolean DEBUG_OPEN_INCOMPATIBLE_WORLDS
      See Also:
    • DEBUG_ALLOW_LOW_SIM_DISTANCE

      public static final boolean DEBUG_ALLOW_LOW_SIM_DISTANCE
      See Also:
    • DEBUG_HOTKEYS

      public static final boolean DEBUG_HOTKEYS
      See Also:
    • DEBUG_UI_NARRATION

      public static final boolean DEBUG_UI_NARRATION
      See Also:
    • DEBUG_RENDER

      public static final boolean DEBUG_RENDER
      See Also:
    • DEBUG_PATHFINDING

      public static final boolean DEBUG_PATHFINDING
      See Also:
    • DEBUG_WATER

      public static final boolean DEBUG_WATER
      See Also:
    • DEBUG_HEIGHTMAP

      public static final boolean DEBUG_HEIGHTMAP
      See Also:
    • DEBUG_COLLISION

      public static final boolean DEBUG_COLLISION
      See Also:
    • DEBUG_SHOW_LOCAL_SERVER_ENTITY_HIT_BOXES

      public static final boolean DEBUG_SHOW_LOCAL_SERVER_ENTITY_HIT_BOXES
      See Also:
    • DEBUG_SUPPORT_BLOCKS

      public static final boolean DEBUG_SUPPORT_BLOCKS
      See Also:
    • DEBUG_SHAPES

      public static final boolean DEBUG_SHAPES
      See Also:
    • DEBUG_NEIGHBORSUPDATE

      public static final boolean DEBUG_NEIGHBORSUPDATE
      See Also:
    • DEBUG_STRUCTURES

      public static final boolean DEBUG_STRUCTURES
      See Also:
    • DEBUG_LIGHT

      public static final boolean DEBUG_LIGHT
      See Also:
    • DEBUG_SKY_LIGHT_SECTIONS

      public static final boolean DEBUG_SKY_LIGHT_SECTIONS
      See Also:
    • DEBUG_WORLDGENATTEMPT

      public static final boolean DEBUG_WORLDGENATTEMPT
      See Also:
    • DEBUG_SOLID_FACE

      public static final boolean DEBUG_SOLID_FACE
      See Also:
    • DEBUG_CHUNKS

      public static final boolean DEBUG_CHUNKS
      See Also:
    • DEBUG_GAME_EVENT_LISTENERS

      public static final boolean DEBUG_GAME_EVENT_LISTENERS
      See Also:
    • DEBUG_DUMP_TEXTURE_ATLAS

      public static final boolean DEBUG_DUMP_TEXTURE_ATLAS
      See Also:
    • DEBUG_DUMP_INTERPOLATED_TEXTURE_FRAMES

      public static final boolean DEBUG_DUMP_INTERPOLATED_TEXTURE_FRAMES
      See Also:
    • DEBUG_STRUCTURE_EDIT_MODE

      public static final boolean DEBUG_STRUCTURE_EDIT_MODE
      See Also:
    • DEBUG_SAVE_STRUCTURES_AS_SNBT

      public static final boolean DEBUG_SAVE_STRUCTURES_AS_SNBT
      See Also:
    • DEBUG_SYNCHRONOUS_GL_LOGS

      public static final boolean DEBUG_SYNCHRONOUS_GL_LOGS
      See Also:
    • DEBUG_VERBOSE_SERVER_EVENTS

      public static final boolean DEBUG_VERBOSE_SERVER_EVENTS
      See Also:
    • DEBUG_NAMED_RUNNABLES

      public static final boolean DEBUG_NAMED_RUNNABLES
      See Also:
    • DEBUG_GOAL_SELECTOR

      public static final boolean DEBUG_GOAL_SELECTOR
      See Also:
    • DEBUG_VILLAGE_SECTIONS

      public static final boolean DEBUG_VILLAGE_SECTIONS
      See Also:
    • DEBUG_BRAIN

      public static final boolean DEBUG_BRAIN
      See Also:
    • DEBUG_BEES

      public static final boolean DEBUG_BEES
      See Also:
    • DEBUG_RAIDS

      public static final boolean DEBUG_RAIDS
      See Also:
    • DEBUG_BLOCK_BREAK

      public static final boolean DEBUG_BLOCK_BREAK
      See Also:
    • DEBUG_RESOURCE_LOAD_TIMES

      public static final boolean DEBUG_RESOURCE_LOAD_TIMES
      See Also:
    • DEBUG_MONITOR_TICK_TIMES

      public static final boolean DEBUG_MONITOR_TICK_TIMES
      See Also:
    • DEBUG_KEEP_JIGSAW_BLOCKS_DURING_STRUCTURE_GEN

      public static final boolean DEBUG_KEEP_JIGSAW_BLOCKS_DURING_STRUCTURE_GEN
      See Also:
    • DEBUG_DONT_SAVE_WORLD

      public static final boolean DEBUG_DONT_SAVE_WORLD
      See Also:
    • DEBUG_LARGE_DRIPSTONE

      public static final boolean DEBUG_LARGE_DRIPSTONE
      See Also:
    • DEBUG_CARVERS

      public static final boolean DEBUG_CARVERS
      See Also:
    • DEBUG_ORE_VEINS

      public static final boolean DEBUG_ORE_VEINS
      See Also:
    • DEBUG_SCULK_CATALYST

      public static final boolean DEBUG_SCULK_CATALYST
      See Also:
    • DEBUG_BYPASS_REALMS_VERSION_CHECK

      public static final boolean DEBUG_BYPASS_REALMS_VERSION_CHECK
      See Also:
    • DEBUG_SOCIAL_INTERACTIONS

      public static final boolean DEBUG_SOCIAL_INTERACTIONS
      See Also:
    • DEBUG_VALIDATE_RESOURCE_PATH_CASE

      public static final boolean DEBUG_VALIDATE_RESOURCE_PATH_CASE
      See Also:
    • DEBUG_UNLOCK_ALL_TRADES

      public static final boolean DEBUG_UNLOCK_ALL_TRADES
      See Also:
    • DEBUG_BREEZE_MOB

      public static final boolean DEBUG_BREEZE_MOB
      See Also:
    • DEBUG_TRIAL_SPAWNER_DETECTS_SHEEP_AS_PLAYERS

      public static final boolean DEBUG_TRIAL_SPAWNER_DETECTS_SHEEP_AS_PLAYERS
      See Also:
    • DEBUG_VAULT_DETECTS_SHEEP_AS_PLAYERS

      public static final boolean DEBUG_VAULT_DETECTS_SHEEP_AS_PLAYERS
      See Also:
    • DEBUG_FORCE_ONBOARDING_SCREEN

      public static final boolean DEBUG_FORCE_ONBOARDING_SCREEN
      See Also:
    • DEBUG_IGNORE_LOCAL_MOB_CAP

      public static final boolean DEBUG_IGNORE_LOCAL_MOB_CAP
      See Also:
    • DEBUG_DISABLE_LIQUID_SPREADING

      public static final boolean DEBUG_DISABLE_LIQUID_SPREADING
      See Also:
    • DEBUG_AQUIFERS

      public static final boolean DEBUG_AQUIFERS
      See Also:
    • DEBUG_JFR_PROFILING_ENABLE_LEVEL_LOADING

      public static final boolean DEBUG_JFR_PROFILING_ENABLE_LEVEL_LOADING
      See Also:
    • debugGenerateSquareTerrainWithoutNoise

      public static boolean debugGenerateSquareTerrainWithoutNoise
    • debugGenerateStripedTerrainWithoutNoise

      public static boolean debugGenerateStripedTerrainWithoutNoise
    • DEBUG_ONLY_GENERATE_HALF_THE_WORLD

      public static final boolean DEBUG_ONLY_GENERATE_HALF_THE_WORLD
      See Also:
    • DEBUG_DISABLE_FLUID_GENERATION

      public static final boolean DEBUG_DISABLE_FLUID_GENERATION
      See Also:
    • DEBUG_DISABLE_AQUIFERS

      public static final boolean DEBUG_DISABLE_AQUIFERS
      See Also:
    • DEBUG_DISABLE_SURFACE

      public static final boolean DEBUG_DISABLE_SURFACE
      See Also:
    • DEBUG_DISABLE_CARVERS

      public static final boolean DEBUG_DISABLE_CARVERS
      See Also:
    • DEBUG_DISABLE_STRUCTURES

      public static final boolean DEBUG_DISABLE_STRUCTURES
      See Also:
    • DEBUG_DISABLE_FEATURES

      public static final boolean DEBUG_DISABLE_FEATURES
      See Also:
    • DEBUG_DISABLE_ORE_VEINS

      public static final boolean DEBUG_DISABLE_ORE_VEINS
      See Also:
    • DEBUG_DISABLE_BLENDING

      public static final boolean DEBUG_DISABLE_BLENDING
      See Also:
    • DEBUG_DISABLE_BELOW_ZERO_RETROGENERATION

      public static final boolean DEBUG_DISABLE_BELOW_ZERO_RETROGENERATION
      See Also:
    • DEFAULT_MINECRAFT_PORT

      public static final int DEFAULT_MINECRAFT_PORT
      The default port used by Minecraft for communication between servers and clients.

      This is not a registered port at the Internet Assigned Numbers Authority, and therefore may conflict with existing applications. Minecraft servers may be hosted at other ports, in which case the clients must supply the correct port when connecting to the server.

      See Also:
    • INGAME_DEBUG_OUTPUT

      public static final boolean INGAME_DEBUG_OUTPUT
      See Also:
    • DEBUG_SUBTITLES

      public static final boolean DEBUG_SUBTITLES
      See Also:
    • FAKE_MS_LATENCY

      public static final int FAKE_MS_LATENCY
      See Also:
    • FAKE_MS_JITTER

      public static final int FAKE_MS_JITTER
      See Also:
    • NETTY_LEAK_DETECTION

      public static final io.netty.util.ResourceLeakDetector.Level NETTY_LEAK_DETECTION
    • COMMAND_STACK_TRACES

      public static final boolean COMMAND_STACK_TRACES
      See Also:
    • DEBUG_WORLD_RECREATE

      public static final boolean DEBUG_WORLD_RECREATE
      See Also:
    • DEBUG_SHOW_SERVER_DEBUG_VALUES

      public static final boolean DEBUG_SHOW_SERVER_DEBUG_VALUES
      See Also:
    • DEBUG_FEATURE_COUNT

      public static final boolean DEBUG_FEATURE_COUNT
      See Also:
    • DEBUG_RESOURCE_GENERATION_OVERRIDE

      public static final boolean DEBUG_RESOURCE_GENERATION_OVERRIDE
      See Also:
    • DEBUG_FORCE_TELEMETRY

      public static final boolean DEBUG_FORCE_TELEMETRY
      See Also:
    • DEBUG_DONT_SEND_TELEMETRY_TO_BACKEND

      public static final boolean DEBUG_DONT_SEND_TELEMETRY_TO_BACKEND
      See Also:
    • MAXIMUM_TICK_TIME_NANOS

      public static final long MAXIMUM_TICK_TIME_NANOS
    • MAXIMUM_BLOCK_EXPLOSION_RESISTANCE

      public static final float MAXIMUM_BLOCK_EXPLOSION_RESISTANCE
      See Also:
    • USE_WORKFLOWS_HOOKS

      public static final boolean USE_WORKFLOWS_HOOKS
      See Also:
    • USE_DEVONLY

      public static final boolean USE_DEVONLY
      See Also:
    • CHECK_DATA_FIXER_SCHEMA

      public static boolean CHECK_DATA_FIXER_SCHEMA
    • IS_RUNNING_IN_IDE

      public static boolean IS_RUNNING_IN_IDE
    • IS_RUNNING_WITH_JDWP

      public static final boolean IS_RUNNING_WITH_JDWP
    • WORLD_RESOLUTION

      public static final int WORLD_RESOLUTION
      See Also:
    • MAX_CHAT_LENGTH

      public static final int MAX_CHAT_LENGTH
      The maximum length of a chat message that can be typed by a player.
      See Also:
    • MAX_USER_INPUT_COMMAND_LENGTH

      public static final int MAX_USER_INPUT_COMMAND_LENGTH
      See Also:
    • MAX_FUNCTION_COMMAND_LENGTH

      public static final int MAX_FUNCTION_COMMAND_LENGTH
      See Also:
    • MAX_PLAYER_NAME_LENGTH

      public static final int MAX_PLAYER_NAME_LENGTH
      See Also:
    • MAX_CHAINED_NEIGHBOR_UPDATES

      public static final int MAX_CHAINED_NEIGHBOR_UPDATES
      See Also:
    • MAX_RENDER_DISTANCE

      public static final int MAX_RENDER_DISTANCE
      See Also:
    • ILLEGAL_FILE_CHARACTERS

      public static final char[] ILLEGAL_FILE_CHARACTERS
      The characters which may not form part of a file's name. Used in various file processing methods to replace these illegal characters with valid characters, such as the underscore "_".

      This collection of characters is a subset of the forbidden characters listed in the documentation for Microsoft Windows, with the addition of the backtick (`).

      See Also:
    • TICKS_PER_SECOND

      public static final int TICKS_PER_SECOND
      The amount of game ticks within a real-life second.

      This is not guaranteed by a running server to be an accurate measurement of real-life seconds. Heavy load on the server may cause the actual tick-to-second ratio to go below this defined ratio.

      See Also:
    • MILLIS_PER_TICK

      public static final int MILLIS_PER_TICK
      See Also:
    • TICKS_PER_MINUTE

      public static final int TICKS_PER_MINUTE
      The amount of game ticks within a real-life minute. This is equal to TICKS_PER_SECOND * 60, and falls under the same guarantees and restrictions as TICKS_PER_SECOND.
      See Also:
    • TICKS_PER_GAME_DAY

      public static final int TICKS_PER_GAME_DAY
      The amount of game ticks within a game day. A game day is defined as 20 real-life minutes, so this is equal to TICKS_PER_MINUTE * 20. This falls under the same guarantees and restrictions as TICKS_PER_SECOND.
      See Also:
    • AVERAGE_GAME_TICKS_PER_RANDOM_TICK_PER_BLOCK

      public static final float AVERAGE_GAME_TICKS_PER_RANDOM_TICK_PER_BLOCK
      See Also:
    • AVERAGE_RANDOM_TICKS_PER_BLOCK_PER_MINUTE

      public static final float AVERAGE_RANDOM_TICKS_PER_BLOCK_PER_MINUTE
      See Also:
    • AVERAGE_RANDOM_TICKS_PER_BLOCK_PER_GAME_DAY

      public static final float AVERAGE_RANDOM_TICKS_PER_BLOCK_PER_GAME_DAY
      See Also:
    • WORLD_ICON_SIZE

      public static final int WORLD_ICON_SIZE
      See Also:
    • CURRENT_VERSION

      @Nullable private static WorldVersion CURRENT_VERSION
  • Constructor Details

    • SharedConstants

      public SharedConstants()
  • Method Details

    • setVersion

      public static void setVersion(WorldVersion pVersion)
      Sets the world version, failing if a different world version is already present.
      Parameters:
      pVersion - the world version to set
      Throws:
      IllegalStateException - if a different world version has already been set previously
    • tryDetectVersion

      public static void tryDetectVersion()
    • getCurrentVersion

      public static WorldVersion getCurrentVersion()
    • getProtocolVersion

      public static int getProtocolVersion()
    • debugVoidTerrain

      public static boolean debugVoidTerrain(ChunkPos pChunkPos)