Link to mcweighteditemstack
An ItemStack with a chance, usually used for recipe outputs.
Careful, if the stack that was used to create the WeightedStack was mutable, then the size setter will mutate the original stack as well!
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Link to implemented-interfaces
MCWeightedItemStack implements the following interfaces. That means all methods defined in these interfaces are also available in MCWeightedItemStack
Link to constructors
Manually creates the weightedItemStack.
Usually you can use the operator or
.weight(weight) method of IItemStack, though
new MCWeightedItemStack(itemStack as IItemStack, weight as double) as MCWeightedItemStack new MCWeightedItemStack(<item:minecraft:bedrock>, 0.5D);
DescriptionThe chance, between 0 (0%) and 1 (100%)
Link to methods
Creates a new Weighted Stack with the given weight
Returns: A new WeightedItemStack
Return Type: MCWeightedItemStack
// MCWeightedItemStack.weight(newWeight as double) as MCWeightedItemStack <item:minecraft:bedrock>.weight(0.5D).weight(0.75D);
Link to 연산자
Creates a new Weighted Stack with the given percentage
myMCWeightedItemStack % newWeight as int <item:minecraft:bedrock>.weight(0.5D) % 75
Sets the itemStack's amount.
If the original Stack was mutable, also mutates the original stack's size.
myMCWeightedItemStack * newAmount as int <item:minecraft:bedrock>.weight(0.5D) * 5
Link to properties
|이름||Type||Has Getter||Has Setter||Description|
DescriptionGets the original (unweighted) stack
DescriptionGets the weight (usually between 0 and 1)