fixed major bug with chest loot sim

This commit is contained in:
Unknown
2020-01-28 17:56:38 -05:00
parent 405e65049e
commit fd35c432d8
@@ -40,18 +40,23 @@ public class ChestLootData implements ISeedData {
.put(LootContextParameters.POSITION, new BlockPos(0, 0, 0)).build(LootContextTypes.CHEST); .put(LootContextParameters.POSITION, new BlockPos(0, 0, 0)).build(LootContextTypes.CHEST);
List<ItemStack> itemStacks = this.lootTable.getDrops(lootContext); List<ItemStack> itemStacks = this.lootTable.getDrops(lootContext);
Map<Item, Integer> lootItems = new HashMap<>();
itemStacks.forEach(itemStack -> {
lootItems.put(itemStack.getItem(), lootItems.getOrDefault(itemStack.getItem(), 0) + itemStack.getCount());
});
Set<Item> foundItems = new HashSet<>(); Set<Item> foundItems = new HashSet<>();
for(ItemStack itemStack: itemStacks) { for(Map.Entry<Item, Integer> lootItem: lootItems.entrySet()) {
Item item = itemStack.getItem(); Item item = lootItem.getKey();
List<Stack> stacks = this.stacksMap.get(item); List<Stack> stacks = this.stacksMap.get(item);
if(stacks == null)continue; if(stacks == null)continue;
boolean matches = true; boolean matches = true;
for(Stack stack: stacks) { for(Stack stack: stacks) {
if(!stack.test(itemStack.getCount())) { if(!stack.test(lootItem.getValue())) {
matches = false; matches = false;
break; break;
} }