Change randomDropItems() to give an equal chance for all results

This commit is contained in:
nossr50 2013-02-16 14:29:44 -08:00
parent cedd8da9ba
commit 3550310e5c

View File

@ -212,8 +212,11 @@ public final class Misc {
* @param quantity The amount of items to drop * @param quantity The amount of items to drop
*/ */
public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) { public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) {
for (int i = 0; i < quantity; i++) { int dropCount = random.nextInt(quantity);
randomDropItem(location, is, chance);
//I could just have the itemstacks quantity value changed but I think this will make it look more natural
for (int i = 0; i < dropCount; i++) {
dropItem(location, is);
} }
} }