use of cavern.util.WeightedItemStack in project Cavern2 by kegare.
the class RandomiteHelper method getDropItem.
public static ItemStack getDropItem() {
if (DROP_ITEMS.isEmpty()) {
return ItemStack.EMPTY;
}
int totalWeight = WeightedRandom.getTotalWeight(DROP_ITEMS);
WeightedItemStack item = WeightedRandom.getRandomItem(DROP_ITEMS, RANDOM.nextInt(totalWeight));
return item != null ? item.getItemStack() : ItemStack.EMPTY;
}
Aggregations