Browse Source

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

nossr50 12 years ago
parent
commit
3550310e5c
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/main/java/com/gmail/nossr50/util/Misc.java

+ 6 - 3
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);
+    	}
     }
 
     /**