Package dev.lone.itemsadder.api
Class CustomCrop
java.lang.Object
dev.lone.itemsadder.api.CustomCrop
Class representing a custom crop in ItemsAdder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable CustomCrop
byAlreadyPlaced
(org.bukkit.block.Block block) Gets a CustomCrop instance through the provided block.int
getAge()
Gets the current age of this CustomCrop.@Nullable List<org.bukkit.inventory.ItemStack>
getLoot()
@Nullable List<org.bukkit.inventory.ItemStack>
getLoot
(@Nullable org.bukkit.inventory.ItemStack toolUsed) static @Nullable List<org.bukkit.inventory.ItemStack>
getLoot
(org.bukkit.block.Block block) static @Nullable List<org.bukkit.inventory.ItemStack>
getLoot
(org.bukkit.block.Block block, @Nullable org.bukkit.inventory.ItemStack toolUsed) int
Gets the maximum age of this CustomCrop.getSeed()
Gets aCustomStack
instance of the Seeds associated with this CustomCrop.void
Increments the current age of this CustomCrop by one.boolean
Returns whether this CustomCrop is fully grown or not.static boolean
isSeed
(org.bukkit.inventory.ItemStack itemStack) static @Nullable CustomCrop
Places a CustomCrop at the provided location and return the CustomCrop instance for it.void
setAge
(int age) Sets the age of this CustomCrop to the provided one.void
Sets the growth-stage of this CustomCrop to fully grown.
-
Constructor Details
-
CustomCrop
public CustomCrop()
-
-
Method Details
-
place
@Nullable public static @Nullable CustomCrop place(String seed_namespacedId, org.bukkit.Location location) Places a CustomCrop at the provided location and return the CustomCrop instance for it.
May return null if the Namespace and ID are invalid.- Parameters:
seed_namespacedId
- Namespace and ID in the formatnamespace:id
location
- The location to place the CustomCrop at.- Returns:
- Possibly-null CustomCrop instance.
-
byAlreadyPlaced
Gets a CustomCrop instance through the provided block.
This may return null if the provided block is not a CustomCrop.- Parameters:
block
- The block to get a CustomCrop instance from.- Returns:
- Possibly-null CustomCrop instance.
-
isSeed
public static boolean isSeed(org.bukkit.inventory.ItemStack itemStack) -
getLoot
@Nullable public static @Nullable List<org.bukkit.inventory.ItemStack> getLoot(org.bukkit.block.Block block, @Nullable @Nullable org.bukkit.inventory.ItemStack toolUsed) -
getLoot
@Nullable public static @Nullable List<org.bukkit.inventory.ItemStack> getLoot(org.bukkit.block.Block block) -
getSeed
Gets aCustomStack
instance of the Seeds associated with this CustomCrop.- Returns:
CustomStack
representing the seeds for this CustomCrop.
-
getLoot
@Nullable public @Nullable List<org.bukkit.inventory.ItemStack> getLoot(@Nullable @Nullable org.bukkit.inventory.ItemStack toolUsed) -
getLoot
-
getAge
public int getAge()Gets the current age of this CustomCrop.- Returns:
- Integer representing the current age of the CustomCrop.
-
setAge
public void setAge(int age) Sets the age of this CustomCrop to the provided one.- Parameters:
age
- the age to set for this CustomCrop.
-
isFullyGrown
public boolean isFullyGrown()Returns whether this CustomCrop is fully grown or not.- Returns:
- true if the CustomCrop is fully grown, otherwise false.
-
getMaxAge
public int getMaxAge()Gets the maximum age of this CustomCrop.- Returns:
- Integer representing the maximum age of the CustomCrop.
-
setFullyGrown
public void setFullyGrown()Sets the growth-stage of this CustomCrop to fully grown. -
incrementAge
public void incrementAge()Increments the current age of this CustomCrop by one.
-