From 4880d134993356c1685b6369a806b6ad7f2a3b90 Mon Sep 17 00:00:00 2001 From: Kam Date: Fri, 15 Sep 2023 14:33:50 -0400 Subject: [PATCH] Fix Drop Chance --- src/main/java/noppes/npcs/DataInventory.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/noppes/npcs/DataInventory.java b/src/main/java/noppes/npcs/DataInventory.java index 22fb23edc..c4e5b8c9a 100644 --- a/src/main/java/noppes/npcs/DataInventory.java +++ b/src/main/java/noppes/npcs/DataInventory.java @@ -15,8 +15,10 @@ import noppes.npcs.entity.EntityNPCInterface; import java.util.ArrayList; import java.util.HashMap; +import java.util.Random; -public class DataInventory implements IInventory{ +public class DataInventory implements IInventory { + public static Random random = new Random(); public HashMap items = new HashMap(); public HashMap dropchance = new HashMap(); public HashMap weapons = new HashMap(); @@ -102,10 +104,12 @@ public class DataInventory implements IInventory{ if(item == null) continue; double dchance = 100; + double chance = random.nextDouble() * 100; if(dropchance.containsKey(i)) dchance = dropchance.get(i); - double chance = Math.random()*100 + dchance; - if(chance >= 100){ + + // double chance = Math.random()*100 + dchance; + if(chance < dchance){ EntityItem e = getEntityItem(item.copy()); if(e != null) list.add(e);