WeightedLiquidStack
Link to weightedliquidstack
A Weighted Liquid Stack is like a normal ILiquidStack but has a percentage added to it.
You normally use them when dealing with percentage based actions like drops or secondary outputs.
パッケージのインポート
Link to パッケージのインポート
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.
import crafttweaker.item.WeightedLiquidStack;
Implementing IWeightedIngredient
Link to implementing-iweightedingredient
WeightedLiquidStack implements IWeightedIngredient. That means all functions available to IWeightedIngredient also are available to WeightedLiquidStack.
Calling a weightedLiquidStack
Link to calling-a-weightedliquidstack
You can derive a weightedLiquidStack from an ILiquidStack by either using the modulo operator or the weight function on it.
ZenScript Copyval liquidStack = <liquid:lava>;
//both create a weightedLiquidstack object with a chance of 20%
val wLiquidStack = liquidStack % 20;
val wLiquidStack2 = liquidStack.weight(0.2);
ZenGetters
Link to zengetters
ZenGetter | What does it do | 戻り値 |
---|---|---|
ZenGetter stack | What does it do Returns the associated LiquidStack | 戻り値 ILiquidStack |
ZenGetter chance | What does it do Returns the stack's chance as decimal (e.g. 0.2) | 戻り値 float |
ZenGetter percent | What does it do Returns the stack's chance as percentage (e.g. 20.0) | 戻り値 float |