Class CustomCrop

java.lang.Object
dev.lone.itemsadder.api.CustomCrop

public class CustomCrop extends Object
Wrapper for a custom crop placed in the world.
  • Constructor Details

    • CustomCrop

      public CustomCrop()
  • Method Details

    • place

      @Nullable public static @Nullable CustomCrop place(String seedId, Location location)
      Places a custom crop using the provided seed namespaced id.
      Parameters:
      seedId - the seed namespaced id.
      location - the location where the crop will be placed.
      Returns:
      the placed crop wrapper, or null if the seed does not exist.
    • byAlreadyPlaced

      @Nullable public static @Nullable CustomCrop byAlreadyPlaced(Block block)
      Gets the custom crop wrapper for an already placed crop block.
      Parameters:
      block - the crop block.
      Returns:
      the crop wrapper, or null if the block is not a custom crop.
    • isSeed

      public static boolean isSeed(ItemStack itemStack)
      Checks if the item is an ItemsAdder custom seed.
      Parameters:
      itemStack - the item to check.
      Returns:
      true if the item is a custom seed.
    • getLoot

      @Nullable public static @Nullable List<ItemStack> getLoot(Block block, @Nullable @Nullable ItemStack toolUsed)
      Gets the loot generated by the custom crop at the provided block.
      Parameters:
      block - the crop block.
      toolUsed - the tool used to break the crop, or null.
      Returns:
      the loot list, or null if the block is not a custom crop.
    • getLoot

      @Nullable public static @Nullable List<ItemStack> getLoot(Block block)
      Gets the loot generated by the custom crop at the provided block.
      Parameters:
      block - the crop block.
      Returns:
      the loot list, or null if the block is not a custom crop.
    • getSeed

      public CustomStack getSeed()
      Gets the seed item used by this crop.
      Returns:
      the seed custom stack.
    • getLoot

      @Nullable public @Nullable List<ItemStack> getLoot(@Nullable @Nullable ItemStack toolUsed)
      Gets the loot generated by this crop.
      Parameters:
      toolUsed - the tool used to break the crop, or null.
      Returns:
      the loot list, or null if this wrapper has no block.
    • getLoot

      @Nullable public @Nullable List<ItemStack> getLoot()
      Gets the loot generated by this crop.
      Returns:
      the loot list, or null if this wrapper has no block.
    • getAge

      public int getAge()
      Gets the current crop age.
      Returns:
      the current age value.
    • setAge

      public void setAge(int age)
      Sets the crop age.
      Parameters:
      age - the new age value.
    • isFullyGrown

      public boolean isFullyGrown()
      Checks if the crop is fully grown.
      Returns:
      true if the current age is the maximum age.
    • getMaxAge

      public int getMaxAge()
      Gets the maximum age supported by this crop block.
      Returns:
      the maximum age.
    • setFullyGrown

      public void setFullyGrown()
      Sets this crop to its maximum age.
    • incrementAge

      public void incrementAge()
      Increases the crop age by one.