Fix Drop Chance

This commit is contained in:
Kam committed 2023-09-15 14:33:50 -04:00
1 parent 5a9bf01f7f
commit 4880d13499
1 file changed
+7 -3
+7 -3
View File
@@ -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<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
public HashMap<Integer,ItemStack> weapons = new HashMap<Integer, ItemStack>();
@@ -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);