use of mcjty.rftoolsdim.dimensions.world.terrain.lost.GenInfo 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++;
}
}
Aggregations