mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
everybody gets a gun
This commit is contained in:
parent
03a6af791f
commit
28d3664781
@ -417,7 +417,7 @@ public class ModEventHandler {
|
||||
}));
|
||||
|
||||
ItemStack bowReplacement = getSkelegun(soot, world.rand);
|
||||
slotPools.put(0, createSlotPool(100, bowReplacement != null ? new Object[][]{{bowReplacement, 1}} : new Object[][]{}));
|
||||
slotPools.put(0, createSlotPool(50, bowReplacement != null ? new Object[][]{{bowReplacement, 1}} : new Object[][]{}));
|
||||
}
|
||||
assignItemsToEntity(entity, slotPools);
|
||||
}
|
||||
@ -429,15 +429,23 @@ public class ModEventHandler {
|
||||
entity.setCurrentItemOrArmor(1, new ItemStack(boots));
|
||||
}
|
||||
|
||||
private List<WeightedRandomObject> createSlotPool(int nullWeight, Object[][] items) { // nullWeight is the weight of the empty slot (no shit)
|
||||
private List<WeightedRandomObject> createSlotPool(int nullWeight, Object[][] items) {
|
||||
List<WeightedRandomObject> pool = new ArrayList<>();
|
||||
pool.add(new WeightedRandomObject(null, nullWeight));
|
||||
for (Object[] item : items) {
|
||||
pool.add(new WeightedRandomObject(new ItemStack((Item) item[0]), (int) item[1]));
|
||||
Object obj = item[0];
|
||||
int weight = (int) item[1];
|
||||
|
||||
if (obj instanceof Item) {
|
||||
pool.add(new WeightedRandomObject(new ItemStack((Item) obj), weight));
|
||||
} else if (obj instanceof ItemStack) { //lol just make it pass ItemStack aswell
|
||||
pool.add(new WeightedRandomObject(obj, weight));
|
||||
}
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
private void assignItemsToEntity(EntityLivingBase entity, Map<Integer, List<WeightedRandomObject>> slotPools) {
|
||||
for (Map.Entry<Integer, List<WeightedRandomObject>> entry : slotPools.entrySet()) {
|
||||
int slot = entry.getKey();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user