Class DimensionUtils

java.lang.Object
org.geysermc.geyser.util.DimensionUtils

public class DimensionUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    String reference to vanilla Java nether dimension identifier
    static String
    String reference to vanilla Java overworld dimension identifier
    static String
    String reference to vanilla Java end dimension identifier
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    changeBedrockNetherId​(boolean isAboveNetherBedrockBuilding)
    The Nether dimension in Bedrock does not permit building above Y128 - the Bedrock above the dimension.
    static String
    getNewDimension​(com.github.steveice10.opennbt.tag.builtin.CompoundTag dimensionTag)
    Determines the new dimension based on the CompoundTag sent by either the ClientboundLoginPacket or ClientboundRespawnPacket.
    static String
    getTemporaryDimension​(String currentDimension, String newDimension)
    Gets the fake, temporary dimension we send clients to so we aren't switching to the same dimension without an additional dimension switch.
    static int
    javaToBedrock​(String javaDimension)
    Map the Java edition dimension IDs to Bedrock edition
    static void
    switchDimension​(GeyserSession session, String javaDimension)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • OVERWORLD

      public static final String OVERWORLD
      String reference to vanilla Java overworld dimension identifier
      See Also:
      Constant Field Values
    • NETHER

      public static final String NETHER
      String reference to vanilla Java nether dimension identifier
      See Also:
      Constant Field Values
    • THE_END

      public static final String THE_END
      String reference to vanilla Java end dimension identifier
      See Also:
      Constant Field Values
  • Constructor Details

    • DimensionUtils

      public DimensionUtils()
  • Method Details

    • switchDimension

      public static void switchDimension(GeyserSession session, String javaDimension)
    • javaToBedrock

      public static int javaToBedrock(String javaDimension)
      Map the Java edition dimension IDs to Bedrock edition
      Parameters:
      javaDimension - Dimension ID to convert
      Returns:
      Converted Bedrock edition dimension ID
    • getNewDimension

      public static String getNewDimension(com.github.steveice10.opennbt.tag.builtin.CompoundTag dimensionTag)
      Determines the new dimension based on the CompoundTag sent by either the ClientboundLoginPacket or ClientboundRespawnPacket.
      Parameters:
      dimensionTag - the packet's dimension tag.
      Returns:
      the dimension identifier.
    • changeBedrockNetherId

      public static void changeBedrockNetherId(boolean isAboveNetherBedrockBuilding)
      The Nether dimension in Bedrock does not permit building above Y128 - the Bedrock above the dimension. This workaround sets the Nether as the End dimension to ignore this limit.
      Parameters:
      isAboveNetherBedrockBuilding - true if we should apply The End workaround
    • getTemporaryDimension

      public static String getTemporaryDimension(String currentDimension, String newDimension)
      Gets the fake, temporary dimension we send clients to so we aren't switching to the same dimension without an additional dimension switch.
      Parameters:
      currentDimension - the current dimension of the player
      newDimension - the new dimension that the player will be transferred to
      Returns:
      the fake dimension to transfer to