Class CustomCrop
java.lang.Object
dev.lone.itemsadder.api.CustomCrop
Wrapper for a custom crop placed in the world.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable CustomCropbyAlreadyPlaced(Block block) Gets the custom crop wrapper for an already placed crop block.intgetAge()Gets the current crop age.getLoot()Gets the loot generated by this crop.Gets the loot generated by the custom crop at the provided block.Gets the loot generated by the custom crop at the provided block.Gets the loot generated by this crop.intGets the maximum age supported by this crop block.getSeed()Gets the seed item used by this crop.voidIncreases the crop age by one.booleanChecks if the crop is fully grown.static booleanChecks if the item is an ItemsAdder custom seed.static @Nullable CustomCropPlaces a custom crop using the provided seed namespaced id.voidsetAge(int age) Sets the crop age.voidSets this crop to its maximum age.
-
Constructor Details
-
CustomCrop
public CustomCrop()
-
-
Method Details
-
place
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
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
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
-
getSeed
-
getLoot
-
getLoot
-
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.
-