public void generateGoldPile(World world, Random rand, BlockPos position) { int height = 1 + new Random().nextInt(7); int chance = rand.nextInt(100); if (chance < 20) { world.setBlockState(position, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (world.getBlockState(position).getBlock() instanceof BlockChest) { TileEntity tileentity1 = world.getTileEntity(position); if (tileentity1 instanceof TileEntityChest && !((TileEntityChest) tileentity1).isInvalid()) { ((TileEntityChest) tileentity1).setLootTable(WorldGenIceDragonCave.ICEDRAGON_CHEST, new Random().nextLong()); } } } else { world.setBlockState(position, ModBlocks.silverPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, height), 3); } }
public void generateGoldPile(World world, Random rand, BlockPos position) { int height = 1 + new Random().nextInt(7); int chance = rand.nextInt(100); if (chance < 20) { world.setBlockState(position, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (world.getBlockState(position).getBlock() instanceof BlockChest) { TileEntity tileentity1 = world.getTileEntity(position); if (tileentity1 instanceof TileEntityChest && !((TileEntityChest) tileentity1).isInvalid()) { ((TileEntityChest) tileentity1).setLootTable(WorldGenFireDragonCave.FIREDRAGON_CHEST, new Random().nextLong()); } } } else { world.setBlockState(position, ModBlocks.goldPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, height), 3); } }
public static void setGoldPile(World world, BlockPos pos) { int chance = new Random().nextInt(99) + 1; if (world.getBlockState(pos).getBlock() instanceof BlockChest) { return; } if (chance < 60) { boolean generateGold = IceAndFire.CONFIG.dragonDenGoldAmount > 1 ? new Random().nextInt(IceAndFire.CONFIG.dragonDenGoldAmount) == 0 : true; world.setBlockState(pos, generateGold ? ModBlocks.goldPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)) : Blocks.AIR.getDefaultState(), 3); } else if (chance > 60 && chance < 62) { world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (world.getBlockState(pos).getBlock() instanceof BlockChest) { TileEntity tileentity1 = world.getTileEntity(pos); if (tileentity1 instanceof TileEntityChest && !((TileEntityChest) tileentity1).isInvalid()) { ((TileEntityChest) tileentity1).setLootTable(FIREDRAGON_CHEST, new Random().nextLong()); } } } }
public static void setGoldPile(World world, BlockPos pos) { int chance = new Random().nextInt(99) + 1; if (world.getBlockState(pos).getBlock() instanceof BlockChest) { return; } if (chance < 60) { boolean generateGold = IceAndFire.CONFIG.dragonDenGoldAmount > 1 ? new Random().nextInt(IceAndFire.CONFIG.dragonDenGoldAmount) == 0 : true; world.setBlockState(pos, generateGold ? ModBlocks.silverPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)) : Blocks.AIR.getDefaultState(), 3); } else if (chance > 60 && chance < 62) { world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (world.getBlockState(pos).getBlock() instanceof BlockChest) { TileEntity tileentity1 = world.getTileEntity(pos); if (tileentity1 instanceof TileEntityChest && !((TileEntityChest) tileentity1).isInvalid()) { ((TileEntityChest) tileentity1).setLootTable(ICEDRAGON_CHEST, new Random().nextLong()); } } } }
private void placeChest(World world, BlockPos pos, EnumFacing facing, Random rand) { world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing), 2); TileEntityChest chest = (TileEntityChest) world.getTileEntity(pos); if (chest != null) LootUtil.generateLoot(chest, rand, chestLoot, 3, 10); }
public static void generateGold(World worldIn, BlockPos blockpos, BlockPos origin, int radius, Random rand) { IBlockState gold = rand.nextBoolean() ? ModBlocks.goldPile.getDefaultState() : ModBlocks.silverPile.getDefaultState(); if (worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), EnumFacing.UP)) { worldIn.setBlockState(blockpos, gold.withProperty(BlockGoldPile.LAYERS, 8), 3); worldIn.setBlockState(MyrmexHive.getGroundedPos(worldIn, blockpos.north()), gold.withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); worldIn.setBlockState(MyrmexHive.getGroundedPos(worldIn, blockpos.south()), gold.withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); worldIn.setBlockState(MyrmexHive.getGroundedPos(worldIn, blockpos.west()), gold.withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); worldIn.setBlockState(MyrmexHive.getGroundedPos(worldIn, blockpos.east()), gold.withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); if (rand.nextInt(3) == 0) { worldIn.setBlockState(blockpos.up(), Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (worldIn.getBlockState(blockpos.up()).getBlock() instanceof BlockChest) { TileEntity tileentity1 = worldIn.getTileEntity(blockpos.up()); if (tileentity1 instanceof TileEntityChest && !((TileEntityChest) tileentity1).isInvalid()) { ((TileEntityChest) tileentity1).setLootTable(MYRMEX_GOLD_CHEST, rand.nextLong()); } } } } }
world.setBlockState(treasurePos, Blocks.CHEST.getDefaultState()); TileEntityChest chest = (TileEntityChest) world.getTileEntity(treasurePos);
world.setBlockState(pos, Blocks.CHEST.correctFacing(world, pos, Blocks.CHEST.getDefaultState()), 2); TileEntity tile = world.getTileEntity(pos);
break; case "chest": IBlockState chestState = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.WEST); world.setBlockState(dataPos, chestState);
world.setBlockState(pos.down(7), Blocks.CHEST.getDefaultState(), 2); TileEntityChest chest = (TileEntityChest) world.getTileEntity(pos.down(7)); if (chest != null)
worldIn.setBlockState(blockpos.up().west(), ModBlocks.goldPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); worldIn.setBlockState(blockpos.up().east(), ModBlocks.goldPile.getDefaultState().withProperty(BlockGoldPile.LAYERS, 1 + new Random().nextInt(7)), 3); worldIn.setBlockState(blockpos.up(2), Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[new Random().nextInt(3)]), 3); if (worldIn.getBlockState(blockpos.up(2)).getBlock() instanceof BlockChest) { TileEntity tileentity1 = worldIn.getTileEntity(blockpos.up(2));
world.setBlockState(new BlockPos(x, y + 2, z), ModBlocks.JUMPING_SPIDER_SPAWNER.getDefaultState(), 2); world.setBlockState(new BlockPos(x, y, z), Blocks.CHEST.getDefaultState(), 2); TileEntityChest chest1 = (TileEntityChest) world.getTileEntity(new BlockPos(x, y, z)); if (chest1 != null) world.setBlockState(new BlockPos(x - 4, y + 11, z + moveyChest), Blocks.CHEST.getDefaultState(), 2); world.setBlockState(new BlockPos(x + 4, y + 11, z + moveyChest), Blocks.CHEST.getDefaultState(), 2); world.setBlockState(new BlockPos(x - 4, y + 12, z + moveyChest), log, 2); world.setBlockState(new BlockPos(x + 4, y + 12, z + moveyChest), log, 2);
worldIn.setBlockState(blockpos2, Blocks.CHEST.correctFacing(worldIn, blockpos2, Blocks.CHEST.getDefaultState()), 2); TileEntity tileentity1 = worldIn.getTileEntity(blockpos2);
player.getServerWorld().setBlockState(message.pos.up(chestHeight), Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, player.getHorizontalFacing()));
else if (!world.isAirBlock(torch.north())) facing = EnumFacing.SOUTH; else if (!world.isAirBlock(torch.south())) facing = EnumFacing.NORTH; world.setBlockState(torch, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing)); TileEntity chest = world.getTileEntity(torch); if (chest instanceof TileEntityChest) {
world.setBlockState(loopPos, Blocks.CHEST.getDefaultState(), MinecraftHelpers.BLOCK_NOTIFY_CLIENT); TileEntityChest tileentitychest = (TileEntityChest)world.getTileEntity(loopPos);
IBlockState chestState = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, chestFacing); world.setBlockState(dataPos, chestState);
world.setBlockState(pos.add(i2, 0, j2), Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing), 16);
world.setBlockState(pos.up(), Blocks.CHEST.getDefaultState()); TileEntityChest chest = (TileEntityChest) world.getTileEntity(pos.up()); if (chest != null)
world.setBlockState(pos.add(19, yy, 22), Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.NORTH), 2); TileEntityChest chest = (TileEntityChest) world.getTileEntity(pos.add(19, yy, 22)); if (chest != null) {