Class CustomFurniture

java.lang.Object
dev.lone.itemsadder.api.CustomStack
dev.lone.itemsadder.api.CustomFurniture

public class CustomFurniture extends CustomStack
Wrapper for simple ItemsAdder furniture spawned in the world.
  • Method Details

    • getNamespacedIdsInRegistry

      public static Set<String> getNamespacedIdsInRegistry()
      Gets all furniture namespaced ids currently registered.
      Returns:
      the registered furniture namespaced ids.
    • byAlreadySpawned

      @Nullable public static @Nullable CustomFurniture byAlreadySpawned(Entity entity)
      Gets a furniture wrapper from an already spawned furniture entity.
      Parameters:
      entity - the Bukkit entity used by the furniture.
      Returns:
      the furniture wrapper, or null if the entity is not furniture.
    • byAlreadySpawned

      @Nullable public static @Nullable CustomFurniture byAlreadySpawned(Block block)
      Gets a furniture wrapper from a block occupied by a furniture entity.
      Parameters:
      block - the block to check.
      Returns:
      the furniture wrapper, or null if no furniture is found.
    • spawnPreciseNonSolid

      @Nullable public static @Nullable CustomFurniture spawnPreciseNonSolid(String namespacedId, Location location)
      Spawns non-solid furniture at an exact location.
      Parameters:
      namespacedId - the furniture namespaced id.
      location - the exact spawn location.
      Returns:
      the spawned furniture wrapper, or null if the furniture does not exist.
    • spawn

      @Nullable public static @Nullable CustomFurniture spawn(String namespacedId, Block blockLocation)
      Spawns furniture at a block location.
      Parameters:
      namespacedId - the furniture namespaced id.
      blockLocation - the target block.
      Returns:
      the spawned furniture wrapper, or null if the furniture does not exist.
    • remove

      public void remove(boolean dropItem)
      Removes this furniture from the world.
      Parameters:
      dropItem - true to drop the furniture item.
    • remove

      public static void remove(Entity entity, boolean dropItem)
      Removes a furniture entity from the world.
      Parameters:
      entity - the furniture entity.
      dropItem - true to drop the furniture item.
    • teleport

      public void teleport(Entity destinationEntity)
      Teleports this furniture to another entity location.
      Parameters:
      destinationEntity - the destination entity.
    • teleport

      public void teleport(Location location)
      Teleports this furniture to a location.
      Parameters:
      location - the destination location.
    • replaceFurniture

      public void replaceFurniture(String newFurnitureNamespacedId)
      Replaces this furniture with another furniture item.
      Parameters:
      newFurnitureNamespacedId - the new furniture namespaced id.
    • replaceFurniture

      public void replaceFurniture(String newFurnitureNamespacedId, Color color)
      Replaces this furniture with another furniture item and applies a color.
      Parameters:
      newFurnitureNamespacedId - the new furniture namespaced id.
      color - the color to apply, or null to keep the default item color.
    • setColor

      public void setColor(Color color)
      Sets the displayed item color when the furniture item supports it.
      Parameters:
      color - the color to apply.
    • getOriginalLightLevel

      public int getOriginalLightLevel()
      Gets the light level configured for this furniture.
      Returns:
      the configured light level.
    • setCurrentLightLevel

      public void setCurrentLightLevel(int level)
      Sets the current light level emitted by this furniture.
      Parameters:
      level - the new light level.
    • getArmorstand

      @Nullable @Deprecated public @Nullable Entity getArmorstand()
      Deprecated.
      use getEntity() instead.
      Gets the Armor stand associated with this CustomFurniture.
      This may return null if the Armor stand is not yet spawned in the world.
      Returns:
      Possibly-null Bukkit Entity instance.
    • getEntity

      @Nullable public @Nullable Entity getEntity()
      Get the armorstand
      Returns:
      null if it's not spawned in world