use of mcjty.rftools.blocks.storage.ModularStorageTileEntity in project RFToolsDimensions by McJty.
the class GenericWorldGenerator method createModularStorage.
private void createModularStorage(Random random, World world, BlockPos pos) {
Block storageBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("rftools", "modular_storage"));
if (storageBlock instanceof BlockAir)
return;
ItemStack module = new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation("rftools", "storage_module")));
world.setBlockState(pos, storageBlock.getDefaultState().withProperty(BaseBlock.FACING, EnumFacing.HORIZONTALS[random.nextInt(EnumFacing.HORIZONTALS.length)]), 18);
TileEntity te = world.getTileEntity(pos);
if (te instanceof ModularStorageTileEntity) {
ModularStorageTileEntity storage = (ModularStorageTileEntity) te;
storage.setInventorySlotContents(ModularStorageContainer.SLOT_STORAGE_MODULE, module);
for (int i = 0; i < 5 + random.nextInt(10); i++) {
storage.setInventorySlotContents(i + ModularStorageContainer.SLOT_STORAGE, randomLoot(random));
}
}
}
Aggregations