Class TerraBukkit
java.lang.Object
net.buildtheearth.terraminusminus.substitutes.TerraBukkit
Compatibility methods to translate between Terra-- internal Minecraft objects into Bukkit API objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.buildtheearth.terraminusminus.substitutes.BiomefromBukkitBiome(org.bukkit.block.Biome biome) Translates BukkitBiomeinto Terra-- internalBiome.static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockStatefromBukkitBlockData(@Nullable org.bukkit.block.data.BlockData data) Translates Bukkit APIBlockDatato Terra-- internalBlockState.static @Nullable net.buildtheearth.terraminusminus.substitutes.BlockPosfromBukkitLocation(@Nullable org.bukkit.Location location) Translate a Bukkit APILocationto an internal Terra--BlockPos.static @Nullable net.buildtheearth.terraminusminus.substitutes.IdentifierfromBukkitNamespacedKey(@Nullable org.bukkit.NamespacedKey namespacedKey) Translate Bukkit API'sNamespacedKeyto Terra-- internalIdentifier.static org.bukkit.block.BiometoBukkitBiome(@Nullable net.buildtheearth.terraminusminus.substitutes.Biome biome) Translates Terra-- internalBiomeinto Bukkit APIBiome.static @Nullable org.bukkit.block.data.BlockDatatoBukkitBlockData(@Nullable net.buildtheearth.terraminusminus.substitutes.BlockState state) Translates internal Terra--blockstatesto Bukkit API's BlockData.static @Nullable org.bukkit.LocationtoBukkitLocation(@Nullable net.buildtheearth.terraminusminus.substitutes.BlockPos blockPos) Translates an internal Terra--BlockPosto Bukkit API'sLocation.static @Nullable org.bukkit.NamespacedKeytoBukkitNamespacedKey(@Nullable net.buildtheearth.terraminusminus.substitutes.Identifier identifier) Translates internal Terra--Identifierto Bukkit API'sNamespacedKey.
-
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--Identifierto Bukkit API'sNamespacedKey. Conserves nullness.
This method has no form of caching and may create a new instance ofNamespacedKeyfor 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'sNamespacedKeyto Terra-- internalIdentifier. Conserves nullness.
This method has no form of caching and may create a new instance ofIdentifierfor each call.- Parameters:
namespacedKey- the Bukkit APINamespacedKey- 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--BlockPosto Bukkit API'sLocation. Conserves nullness.
TheLocationworld isnull, yaw and pitch are 0.
This method has no form of caching and may create a new instance ofLocationfor 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 APILocationto an internal Terra--BlockPos. Conserves nullness.
This method has no form of caching and may create a new instance ofBlockPosfor each call.- Parameters:
location- the Bukkit APILocation- Returns:
- the internal Terra--
BlockPos - Throws:
net.buildtheearth.terraminusminus.substitutes.exceptions.TranslateToSubstituteException- if one of thelocation'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--blockstatesto Bukkit API's BlockData. Conserves nullness.
If theBlockStateimplementation 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 APIBlockDatato Terra-- internalBlockState. Conserves nullness.
This method has no form of caching and may create a new instance ofBlockDatafor each call.- Parameters:
data- the Bukkit APIBlockData- 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-- internalBiomeinto Bukkit APIBiome. Conserves nullness.
IfBiomeimplementation 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 BukkitBiomeinto Terra-- internalBiome. Conserves nullness.
This method has no form of caching and may create a new instance ofBiomefor each call.- Parameters:
biome- the BukkitBiome- Returns:
- the Terra--
Biome
-