World world = // get world reference BlockPos pos = new BlockPos(x, y, z); TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof ChestTileEntity) { ChestTileEntity chest = (ChestTileEntity) tileEntity; IInventory inventory = chest.getInventory(); // perform actions with inventory }
World world = // get world reference BlockPos pos = new BlockPos(x, y, z); TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof BeaconTileEntity) { BeaconTileEntity beacon = (BeaconTileEntity) tileEntity; int levels = beacon.getLevels(); // perform actions with levels }Both examples use the "net.minecraft.world" package library in Java.