public class ItemWithChance
extends java.lang.Object
Constructor and Description |
---|
ItemWithChance(net.minecraft.item.ItemStack itemStack,
int amount)
Guaranteed item with guaranteed amount
|
ItemWithChance(net.minecraft.item.ItemStack itemStack,
int amount,
double chance)
Item with guaranteed amount and a chance
|
ItemWithChance(net.minecraft.item.ItemStack itemStack,
int min,
int max)
Guaranteed item with min and max amount
|
ItemWithChance(net.minecraft.item.ItemStack itemStack,
int min,
int max,
double chance)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
double |
getChance()
Gets the chance of the item being given (0 - 1)
|
net.minecraft.item.ItemStack |
getItem()
Gets the item using randomness for the chance and amount
|
net.minecraft.item.ItemStack |
getItemStack()
Gets a copy of the
ItemStack being cloned and then given to the player |
int |
getMax()
Gets the maximum amount of the item
|
int |
getMin()
Gets the minimum amount of the item
|
static java.util.List<ItemWithChance> |
parse(com.google.gson.JsonArray array)
Parses a
JsonArray to a list of items with chance |
static ItemWithChance |
parse(com.google.gson.JsonObject object)
Parses a
JsonObject to am item with chance |
public ItemWithChance(net.minecraft.item.ItemStack itemStack, int amount)
itemStack
- The itemamount
- The amount of the itempublic ItemWithChance(net.minecraft.item.ItemStack itemStack, int amount, double chance)
itemStack
- The item being givenamount
- The amount of the itemchance
- The chance of being givenpublic ItemWithChance(net.minecraft.item.ItemStack itemStack, int min, int max)
itemStack
- The item being givenmin
- The minimum amountmax
- The maximum amountpublic ItemWithChance(net.minecraft.item.ItemStack itemStack, int min, int max, double chance)
itemStack
- The itemmin
- The minimum amountmax
- The maximum amountchance
- The chance of being given (max 1.0, min 0.0 - inclusive for both)public net.minecraft.item.ItemStack getItemStack()
ItemStack
being cloned and then given to the playerpublic int getMin()
public int getMax()
public double getChance()
public net.minecraft.item.ItemStack getItem()
public static java.util.List<ItemWithChance> parse(com.google.gson.JsonArray array)
JsonArray
to a list of items with chancearray
- The array being parsedpublic static ItemWithChance parse(com.google.gson.JsonObject object)
JsonObject
to am item with chanceobject
- The object being parsed