Search in sources :

Example 1 with BuildingInfo

use of mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo in project RFToolsDimensions by McJty.

the class GenericWorldGenerator method generateVines.

private void generateVines(Random random, int chunkX, int chunkZ, World world) {
    int cx = chunkX * 16;
    int cz = chunkZ * 16;
    BuildingInfo info = new BuildingInfo(chunkX, chunkZ, world.getSeed());
    int bottom = Math.max(66, info.hasBuilding ? (69 + info.floors * 6) : 66);
    if (info.getXmin().hasBuilding) {
        if (info.getXmin().getDamageArea().getDamageFactor() < .4f) {
            for (int z = 0; z < 15; z++) {
                for (int y = bottom; y < (63 + info.getXmin().floors * 6); y++) {
                    if (random.nextFloat() < LostCityConfiguration.VINE_CHANCE) {
                        createVineStrip(random, world, bottom, y, BlockVine.WEST, cx + 0, cz + z);
                    }
                }
            }
        }
    }
    if (info.getXmax().hasBuilding) {
        if (info.getXmax().getDamageArea().getDamageFactor() < .4f) {
            for (int z = 0; z < 15; z++) {
                for (int y = bottom; y < (63 + info.getXmax().floors * 6); y++) {
                    if (random.nextFloat() < LostCityConfiguration.VINE_CHANCE) {
                        createVineStrip(random, world, bottom, y, BlockVine.EAST, cx + 15, cz + z);
                    }
                }
            }
        }
    }
    if (info.getZmin().hasBuilding) {
        if (info.getZmin().getDamageArea().getDamageFactor() < .4f) {
            for (int x = 0; x < 15; x++) {
                for (int y = bottom; y < (63 + info.getZmin().floors * 6); y++) {
                    if (random.nextFloat() < LostCityConfiguration.VINE_CHANCE) {
                        createVineStrip(random, world, bottom, y, BlockVine.NORTH, cx + x, cz + 0);
                    }
                }
            }
        }
    }
    if (info.getZmax().hasBuilding) {
        if (info.getZmax().getDamageArea().getDamageFactor() < .4f) {
            for (int x = 0; x < 15; x++) {
                for (int y = bottom; y < (63 + info.getZmax().floors * 6); y++) {
                    if (random.nextFloat() < LostCityConfiguration.VINE_CHANCE) {
                        createVineStrip(random, world, bottom, y, BlockVine.SOUTH, cx + x, cz + 15);
                    }
                }
            }
        }
    }
}
Also used : BuildingInfo(mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo)

Example 2 with BuildingInfo

use of mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo in project RFToolsDimensions by McJty.

the class GenericWorldGenerator method generateLootSpawners.

private void generateLootSpawners(Random random, int chunkX, int chunkZ, World world) {
    BuildingInfo info = new BuildingInfo(chunkX, chunkZ, world.getSeed());
    int buildingtop = 0;
    boolean building = info.hasBuilding;
    if (building) {
        buildingtop = 69 + info.floors * 6;
    }
    int height = 63 - info.floorsBelowGround * 6;
    while (height < buildingtop) {
        int f = LostCitiesTerrainGenerator.getFloor(height);
        if (f == 0) {
            BlockPos floorpos = new BlockPos(chunkX * 16, height, chunkZ * 16);
            int floortype = info.floorTypes[LostCitiesTerrainGenerator.getLevel(height) + info.floorsBelowGround];
            GenInfo getInfo = LostCitiesTerrainGenerator.getGenInfos().get(Pair.of(info.getGenInfoIndex(), floortype));
            for (BlockPos p : getInfo.getChest()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createLootChest(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getRandomFeatures()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createRandomFeature(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getModularStorages()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createModularStorage(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getRandomRFToolsMachines()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createRFToolsMachine(random, world, pos);
                }
            }
            for (Map.Entry<BlockPos, Integer> entry : getInfo.getSpawnerType().entrySet()) {
                BlockPos pos = floorpos.add(entry.getKey());
                if (!world.isAirBlock(pos)) {
                    world.setBlockState(pos, Blocks.MOB_SPAWNER.getDefaultState(), 18);
                    TileEntity tileentity = world.getTileEntity(pos);
                    if (tileentity instanceof TileEntityMobSpawner) {
                        TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileentity;
                        switch(entry.getValue()) {
                            case 1:
                                MobSpawnerBaseLogic mobspawnerbaselogic3 = spawner.getSpawnerBaseLogic();
                                mobspawnerbaselogic3.setEntityId(new ResourceLocation("minecraft:zombie"));
                                spawner.markDirty();
                                break;
                            case 2:
                                MobSpawnerBaseLogic mobspawnerbaselogic2 = spawner.getSpawnerBaseLogic();
                                mobspawnerbaselogic2.setEntityId(new ResourceLocation("minecraft:skeleton"));
                                spawner.markDirty();
                                break;
                            case 3:
                                MobSpawnerBaseLogic mobspawnerbaselogic1 = spawner.getSpawnerBaseLogic();
                                mobspawnerbaselogic1.setEntityId(new ResourceLocation("minecraft:spider"));
                                spawner.markDirty();
                                break;
                            case 4:
                                MobSpawnerBaseLogic mobspawnerbaselogic = spawner.getSpawnerBaseLogic();
                                mobspawnerbaselogic.setEntityId(new ResourceLocation("minecraft:blaze"));
                                spawner.markDirty();
                                break;
                        }
                    }
                }
            }
        }
        height++;
    }
}
Also used : ModularStorageTileEntity(mcjty.rftools.blocks.storage.ModularStorageTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) MobSpawnerBaseLogic(net.minecraft.tileentity.MobSpawnerBaseLogic) BuildingInfo(mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo) ResourceLocation(net.minecraft.util.ResourceLocation) BlockPos(net.minecraft.util.math.BlockPos) GenInfo(mcjty.rftoolsdim.dimensions.world.terrain.lost.GenInfo) TileEntityMobSpawner(net.minecraft.tileentity.TileEntityMobSpawner) Map(java.util.Map)

Aggregations

BuildingInfo (mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo)2 Map (java.util.Map)1 ModularStorageTileEntity (mcjty.rftools.blocks.storage.ModularStorageTileEntity)1 GenInfo (mcjty.rftoolsdim.dimensions.world.terrain.lost.GenInfo)1 MobSpawnerBaseLogic (net.minecraft.tileentity.MobSpawnerBaseLogic)1 TileEntity (net.minecraft.tileentity.TileEntity)1 TileEntityMobSpawner (net.minecraft.tileentity.TileEntityMobSpawner)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1