@Override
public void fillInventory(IInventory inventory, Random rand, LootContext context)
{
TileEntityChest chest = (TileEntityChest) inventory;
CustomLootContext.Builder context$builder = new CustomLootContext.Builder((WorldServer) chest.getWorld());
context$builder.withChestPos(chest.getPos());
CustomLootContext customContext = context$builder.build();
List<ItemStack> list = this.generateLootForPools(rand, customContext);
List<Integer> list1 = this.getEmptySlotsRandomized(inventory, rand);
this.shuffleItems(list, list1.size(), rand);
for (ItemStack itemstack : list)
{
if (list1.isEmpty())
{
LootSlashConquer.LOGGER.warn("Tried to over-fill a container");
return;
}
if (itemstack.isEmpty())
{
inventory.setInventorySlotContents(((Integer)list1.remove(list1.size() - 1)).intValue(), ItemStack.EMPTY);
}
else
{
inventory.setInventorySlotContents(((Integer)list1.remove(list1.size() - 1)).intValue(), itemstack);
}
}
}
CustomLootTable.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:Loot-Slash-Conquer
作者:
评论列表
文章目录