MCWeightedItemStack
Link to mcweighteditemstack
Un ItemStack con una possibilità, di solito usato per gli output delle ricette.
Attenzione, se lo stack che è stato utilizzato per creare il WeightedStack era mutabile, allora il setter di dimensioni muterà anche lo stack originale!
Importare la Classe
Link to importare-la-classe
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;
Interfacce Implementate
Link to interfacce-implementate
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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro itemStack | Tipo IItemStack | Descrizione La Pila |
Parametro weight | Tipo double | Descrizione La possibilità, tra 0 (0%) e 1 (100%) |
Metodi
Link to metodi
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);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro NuovoPeso | Tipo double | Descrizione La percentuale |
Operators
Link to operators
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
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome stack | Tipo IItemStack | Ha Getter sì | Ha Setter no | Descrizione Gets the original (unweighted) stack |
Nome weight | Tipo double | Ha Getter sì | Ha Setter no | Descrizione Gets the weight (usually between 0 and 1) |