MCWeightedItemStack
Link to mcweighteditemstack
ItemStack は、通常レシピ出力に使用されます。
WeightedStack を作成するために使用されたスタックが変更可能であれば、サイズ設定者は元のスタックも変更します!
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.
ZenScript Copyimport crafttweaker.api.item.MCWeightedItemStack;
Implemented Interfaces
Link to implemented-interfaces
MCWeightedItemStack implements the following interfaces. That means all methods defined in these interfaces are also available in MCWeightedItemStack
Constructors
Link to constructors
Manually creates the weightedItemStack.
Usually you can use the operator or .weight(weight)
method of IItemStack, though
ZenScript Copynew MCWeightedItemStack(itemStack as IItemStack, weight as double) as MCWeightedItemStack
new MCWeightedItemStack(<item:minecraft:bedrock>, 0.5D);
Parameter | Type | Description |
---|---|---|
Parameter itemStack | Type IItemStack | Description スタック |
Parameter weight | Type double | Description 0 (0%)から1 (100%)の間のチャンス |
Methods
Link to methods
Name: weight
Creates a new Weighted Stack with the given weight
Returns: A new WeightedItemStack
Return Type: MCWeightedItemStack
ZenScript Copy// MCWeightedItemStack.weight(newWeight as double) as MCWeightedItemStack
<item:minecraft:bedrock>.weight(0.5D).weight(0.75D);
Parameter | Type | Description |
---|---|---|
Parameter 新しい重量 | Type double | Description 割合 |
演算子
Link to 演算子
Name: MOD
Creates a new Weighted Stack with the given percentage
ZenScript CopymyMCWeightedItemStack % newWeight as int
<item:minecraft:bedrock>.weight(0.5D) % 75
Name: MUL
Sets the itemStack's amount.
If the original Stack was mutable, also mutates the original stack's size.
ZenScript CopymyMCWeightedItemStack * newAmount as int
<item:minecraft:bedrock>.weight(0.5D) * 5
Properties
Link to properties
名称 | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
名称 stack | Type IItemStack | Has Getter true | Has Setter false | Description Gets the original (unweighted) stack |
名称 weight | Type double | Has Getter true | Has Setter false | Description Gets the weight (usually between 0 and 1) |