Class StructureApi

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

public class StructureApi extends Object
API methods relating to Structures
  • Method Details

    • placeConfiguredFeature

      public static boolean placeConfiguredFeature(@NotNull @NotNull NamespacedKey featureKey, @NotNull @NotNull Location location)
      Place a configured feature
      Parameters:
      featureKey - Key of feature to place
      location - Location to place at
      Returns:
      True if feature was placed, otherwise false if failed
      See Also:
    • placePlacedFeature

      public static boolean placePlacedFeature(@NotNull @NotNull NamespacedKey featureKey, @NotNull @NotNull Location location)
      Place a placed feature
      Parameters:
      featureKey - Key of feature to place
      location - Location to place at
      Returns:
      True if feature was placed, otherwise false if failed
      See Also:
    • locateNearestStructure

      @Nullable public static @Nullable Location locateNearestStructure(@NotNull @NotNull NamespacedKey structureKey, @NotNull @NotNull Location location)
      Locate the nearest placed structure

      This does not mean a StructureBlock Structure, this means a structure placed in a world, such as a village. Will default to a radius of 6400 and true for findUnexplored.

      Parameters:
      structureKey - Key of structure to find
      location - Location to center search from
      Returns:
      Location of structure if found, otherwise null
    • locateNearestStructure

      @Nullable public static @Nullable Location locateNearestStructure(@NotNull @NotNull NamespacedKey structureKey, @NotNull @NotNull Location location, int radius, boolean findUnexplored)
      Locate the nearest placed structure

      This does not mean a StructureBlock Structure, this means a structure placed in a world, such as a village.

      Parameters:
      structureKey - Key of structure to find
      location - Location to center search from
      radius - Max radius to search in
      findUnexplored - Whether to look for structures that haven't generated yet
      Returns:
      Location of structure if found, otherwise null
    • getConfiguredFeatures

      @NotNull public static @NotNull List<NamespacedKey> getConfiguredFeatures()
      Get a list of all registered configured features
      Returns:
      List of all registered configured features
    • getPlacedFeatures

      @NotNull public static @NotNull List<NamespacedKey> getPlacedFeatures()
      Get a list of all registered placed features
      Returns:
      List of all registered placed features
    • getStructures

      @NotNull public static @NotNull List<NamespacedKey> getStructures()
      Get a list of available structures

      This does not mean StructureBlock Structures, this means structures placed in a world, such as a village.

      Returns:
      List of available structures
    • getStructureTemplates

      public static List<NamespacedKey> getStructureTemplates()
      Get a list of available structure templates

      You can load via StructureManager.getStructure(NamespacedKey), and place into world via Structure.place(Location, boolean, StructureRotation, Mirror, int, float, Random)

      Returns:
      List of available structure templates