backpack.setTagCompound(compound);
}
if (contents != null) {
// Add random items to the backpack.
InventoryStacks inventory = new InventoryStacks(contents);
// Add normal random backpack loot.
WeightedRandomChestContent.generateChestContents(
RandomUtils.random, randomBackpackItems, inventory, 20);
// With a chance of 10%, add some random dungeon loot.
if (RandomUtils.getDouble() < 0.1) {