java.lang.Object
net.buildtheearth.terraminusminus.substitutes.TerraBukkit

public final class TerraBukkit extends Object
Compatibility methods to translate between Terra-- internal Minecraft objects into Bukkit API objects.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.buildtheearth.terraminusminus.substitutes.Biome
    fromBukkitBiome(org.bukkit.block.Biome biome)
    Translates Bukkit Biome into Terra-- internal Biome.
    static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockState
    fromBukkitBlockData(@Nullable org.bukkit.block.data.BlockData data)
    Translates Bukkit API BlockData to Terra-- internal BlockState.
    static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockPos
    fromBukkitLocation(@Nullable org.bukkit.Location location)
    Translate a Bukkit API Location to an internal Terra-- BlockPos.
    static @Nullable net.buildtheearth.terraminusminus.substitutes.Identifier
    fromBukkitNamespacedKey(@Nullable org.bukkit.NamespacedKey namespacedKey)
    Translate Bukkit API's NamespacedKey to Terra-- internal Identifier.
    static org.bukkit.block.Biome
    toBukkitBiome(@Nullable net.buildtheearth.terraminusminus.substitutes.Biome biome)
    Translates Terra-- internal Biome into Bukkit API Biome.
    static @Nullable org.bukkit.block.data.BlockData
    toBukkitBlockData(@Nullable net.buildtheearth.terraminusminus.substitutes.BlockState state)
    Translates internal Terra-- blockstates to Bukkit API's BlockData.
    static @Nullable org.bukkit.Location
    toBukkitLocation(@Nullable net.buildtheearth.terraminusminus.substitutes.BlockPos blockPos)
    Translates an internal Terra-- BlockPos to Bukkit API's Location.
    static @Nullable org.bukkit.NamespacedKey
    toBukkitNamespacedKey(@Nullable net.buildtheearth.terraminusminus.substitutes.Identifier identifier)
    Translates internal Terra-- Identifier to Bukkit API's NamespacedKey.

    Methods inherited from class java.lang.Object

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

    • TerraBukkit

      public TerraBukkit()
  • Method Details

    • toBukkitNamespacedKey

      @Contract("!null -> !null; null -> null") @Nullable public static @Nullable org.bukkit.NamespacedKey toBukkitNamespacedKey(@Nullable @Nullable net.buildtheearth.terraminusminus.substitutes.Identifier identifier)
      Translates internal Terra-- Identifier to Bukkit API's NamespacedKey. Conserves nullness.
      This method has no form of caching and may create a new instance of NamespacedKey for each call.
      Parameters:
      identifier - the Terra-- Identifier
      Returns:
      the Bukkit API NamespacedKey
    • fromBukkitNamespacedKey

      @Contract("!null -> new; null -> null") @Nullable public static @Nullable net.buildtheearth.terraminusminus.substitutes.Identifier fromBukkitNamespacedKey(@Nullable @Nullable org.bukkit.NamespacedKey namespacedKey)
      Translate Bukkit API's NamespacedKey to Terra-- internal Identifier. Conserves nullness.
      This method has no form of caching and may create a new instance of Identifier for each call.
      Parameters:
      namespacedKey - the Bukkit API NamespacedKey
      Returns:
      the Terra-- Identifier
    • toBukkitLocation

      @Contract("!null -> new; null -> null") @Nullable public static @Nullable org.bukkit.Location toBukkitLocation(@Nullable @Nullable net.buildtheearth.terraminusminus.substitutes.BlockPos blockPos)
      Translates an internal Terra-- BlockPos to Bukkit API's Location. Conserves nullness.
      The Location world is null, yaw and pitch are 0.
      This method has no form of caching and may create a new instance of Location for each call.
      Parameters:
      blockPos - the Terra-- BlockPos
      Returns:
      the Bukkit API Location
    • fromBukkitLocation

      @Contract("!null -> !null; null -> null") @Nullable public static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockPos fromBukkitLocation(@Nullable @Nullable org.bukkit.Location location) throws net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToSubstituteException
      Translate a Bukkit API Location to an internal Terra-- BlockPos. Conserves nullness.
      This method has no form of caching and may create a new instance of BlockPos for each call.
      Parameters:
      location - the Bukkit API Location
      Returns:
      the internal Terra-- BlockPos
      Throws:
      net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToSubstituteException - if one of the location's x, y or z components is not a finite double
    • toBukkitBlockData

      @Contract("!null -> !null; null -> null") @Nullable public static @Nullable org.bukkit.block.data.BlockData toBukkitBlockData(@Nullable @Nullable net.buildtheearth.terraminusminus.substitutes.BlockState state) throws net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToForeignObjectException
      Translates internal Terra-- blockstates to Bukkit API's BlockData. Conserves nullness.
      If the BlockState implementation is the canonical Terra-- one, takes advantage of an internal cache for optimized conversions.
      Parameters:
      state - the Terra-- BlockState
      Returns:
      the Bukkit API BlockData
      Throws:
      net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToForeignObjectException - if the block state is invalid to the Bukkit implementation (e.g. it is from newer Minecraft versions and the block does not yet exist in the Bukkit server version).
    • fromBukkitBlockData

      @Contract("!null -> !null; null -> null") @Nullable public static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockState fromBukkitBlockData(@Nullable @Nullable org.bukkit.block.data.BlockData data)
      Translates Bukkit API BlockData to Terra-- internal BlockState. Conserves nullness.
      This method has no form of caching and may create a new instance of BlockData for each call.
      Parameters:
      data - the Bukkit API BlockData
      Returns:
      the Terra-- BlockState
    • toBukkitBiome

      @Contract("!null -> !null; null -> null") @Nullable public static org.bukkit.block.Biome toBukkitBiome(@Nullable @Nullable net.buildtheearth.terraminusminus.substitutes.Biome biome)
      Translates Terra-- internal Biome into Bukkit API Biome. Conserves nullness.
      If Biome implementation is the canonical Terra--, this methods makes use of an internal cache to avoid allocating a new object and speed things up.
      Parameters:
      biome - the Terra-- Biome
      Returns:
      the Bukkit API Biome
      Throws:
      net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToForeignObjectException - if the biome is unknown to the Bukkit implementation (e.g. it is from newer Minecraft versions and the biome does not yet exist in the Bukkit server version).
    • fromBukkitBiome

      @Contract("!null -> !null; null -> null") public static net.buildtheearth.terraminusminus.substitutes.Biome fromBukkitBiome(org.bukkit.block.Biome biome)
      Translates Bukkit Biome into Terra-- internal Biome. Conserves nullness.
      This method has no form of caching and may create a new instance of Biome for each call.
      Parameters:
      biome - the Bukkit Biome
      Returns:
      the Terra-- Biome