Class WorldApi

java.lang.Object
com.shanebeestudios.nms.api.world.WorldApi

public class WorldApi extends Object
API methods relating to Worlds
  • Method Details

    • getBiome

      @NotNull public static @NotNull NamespacedKey getBiome(@NotNull @NotNull Location location)
      Get the NamespacedKey of a Biome at a specific location. This will include custom biomes as well.
      Parameters:
      location - Location to grab biome at
      Returns:
      Key of biome
    • setBiome

      public static void setBiome(@NotNull @NotNull Location location, @NotNull @NotNull NamespacedKey biomeKey)
      Set a biome at a location, including custom biomes.

      Will not send biome updates to players.

      Parameters:
      location - Location of biome to change
      biomeKey - Key of biome
    • fillBiome

      public static void fillBiome(@NotNull @NotNull Location location, @NotNull @NotNull Location location2, @NotNull @NotNull NamespacedKey biomeKey)
      Fill a Biome between 2 locations.

      Will also send biome updates to players.

      Parameters:
      location - First corner
      location2 - Second corner
      biomeKey - Key of biome
    • fillBiome

      public static void fillBiome(@NotNull @NotNull Location location, @NotNull @NotNull Location location2, @NotNull @NotNull NamespacedKey biomeKey, @Nullable @Nullable NamespacedKey replaceKey)
      Fill a Biome between 2 locations with an option to only replace a specific Biome.

      Will also send biome updates to players.

      Parameters:
      location - First corner
      location2 - Second corner
      biomeKey - Key of biome
      replaceKey - Key of biome to replace
    • locateBiome

      @Nullable public static @Nullable Location locateBiome(@NotNull @NotNull NamespacedKey biomeKey, @NotNull @NotNull Location center)
      Locate a biome in a radius of a location

      Defaults to 6400 radius with 8 steps

      Parameters:
      biomeKey - NamespacedKey of biome to find
      center - Where to look from
      Returns:
      Location if a biome is found, null otherwise
    • locateBiome

      @Nullable public static @Nullable Location locateBiome(@NotNull @NotNull NamespacedKey biomeKey, @NotNull @NotNull Location center, int radius, int step)
      Locate a biome in a radius of a location
      Parameters:
      biomeKey - NamespacedKey of biome to find
      center - Where to look from
      radius - Max radius to search
      step - How many blocks to check in steps
      Returns:
      Location if a biome is found, null otherwise
    • getBiomeKeys

      @NotNull public static @NotNull List<NamespacedKey> getBiomeKeys()
      Get a list of all available biomes as NamespacedKeys Includes custom biomes as well
      Returns:
      List of biomes
    • isWithinVillage

      public static boolean isWithinVillage(Location location)
      Check if a location is within a village
      Parameters:
      location - Location to check if in village
      Returns:
      True if location is within a village
    • fillBlocks

      public static void fillBlocks(@NotNull @NotNull Location location, @NotNull @NotNull Location location2, @NotNull @NotNull BlockData data, @Nullable @Nullable BlockData replace)
      Fill blocks within 2 locations

      Similar system to Minecraft's fill command

      Parameters:
      location - Corner 1
      location2 - Corner 2
      data - BlockData to set
      replace - BlockData to replace (can be null)