Package forestry.api.core
Interface IProduct
- All Known Implementing Classes:
Product
public interface IProduct
Represents some item that has a set chance of being produced.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final it.unimi.dsi.fastutil.Hash.Strategy<IProduct>A hashing strategy used for FastUtil custom hash collections. -
Method Summary
Modifier and TypeMethodDescriptionfloatchance()default net.minecraft.world.item.ItemStackcreateRandomStack(net.minecraft.util.RandomSource random) Used to produce a random variant of this product.net.minecraft.world.item.ItemStacknet.minecraft.world.item.Itemitem()Gets the item this product contains.
-
Field Details
-
ITEM_ONLY_STRATEGY
A hashing strategy used for FastUtil custom hash collections. Currently, Forestry uses this to remove common products between species from the product list of a hybrid bee.
-
-
Method Details
-
item
net.minecraft.world.item.Item item()Gets the item this product contains. In the case of a dynamic product, return an item that might be used to display it in a screen or for equality purposes inITEM_ONLY_STRATEGY.- Returns:
- The item this product represents.
-
chance
float chance()- Returns:
- The set chance of this product being produced.
-
createStack
net.minecraft.world.item.ItemStack createStack()- Returns:
- A new stack of this product. If your product is dynamic, return a "default" nonempty stack.
-
createRandomStack
default net.minecraft.world.item.ItemStack createRandomStack(net.minecraft.util.RandomSource random) Used to produce a random variant of this product.- Parameters:
random- The random source. If no randomness is desired, callcreateStack()instead.- Returns:
- A new stack of this product with potentially random properties.
-