From 3550310e5cf8bc9b133fdc9973ca155a3dfd981f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 16 Feb 2013 14:29:44 -0800 Subject: [PATCH] Change randomDropItems() to give an equal chance for all results --- src/main/java/com/gmail/nossr50/util/Misc.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index eca640cdb..115e2900a 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -212,9 +212,12 @@ public final class Misc { * @param quantity The amount of items to drop */ public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) { - for (int i = 0; i < quantity; i++) { - randomDropItem(location, is, chance); - } + int dropCount = random.nextInt(quantity); + + //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); + } } /**