Changed ruins to use chance within tries per chunk
This commit is contained in:
parent
bf9af1a51d
commit
f181a51ca0
3 changed files with 53 additions and 61 deletions
|
|
@ -69,17 +69,17 @@ public class Config {
|
|||
build.append(",");
|
||||
}
|
||||
config.addCustomCategoryComment("General", build.toString());
|
||||
RuinRarity = config.get("General", "Ruin Rarity", 2, "Tries per chunk : lower to make rarer").getInt();
|
||||
DunRarity = config.get("General", "Mystic Dungeon Rarity", 1, "Tries per chunk : lower to make rarer").getInt();
|
||||
RuinRarity = config.get("General", "Ruin Rarity", 200, "Chance per chunk : lower to make rarer").getInt();
|
||||
DunRarity = config.get("General", "Mystic Dungeon Rarity", 100, "Chance per chunk : lower to make rarer").getInt();
|
||||
String[] ID;
|
||||
for (int i = 0; i < allows.length; i++) {
|
||||
ID = config
|
||||
.get("General", allows[i], i < 2 ? "0,[2;10]" : "ALL,-WATER",
|
||||
i < 2 ? "Use [id1;id2] to add a range of id, prefix with - to exclude" : "Use ALL or * for all biomes, select with biome id or biome tags, prefix with - to exclude")
|
||||
.getString().split(",");
|
||||
allowId[i] = new HashSet();
|
||||
allowId[i] = new HashSet<Integer>();
|
||||
if (i > 1) {
|
||||
allowType[i - 2] = new HashSet();
|
||||
allowType[i - 2] = new HashSet<Type>();
|
||||
}
|
||||
for (String txt : ID) {
|
||||
if (i > 1 && txt.startsWith("-")) {
|
||||
|
|
|
|||
|
|
@ -29,36 +29,32 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
int i3 = random.nextInt(8) + 5;
|
||||
int l3 = random.nextInt(8) + 5;
|
||||
int k4 = random.nextInt(4) + 3;
|
||||
int j5 = 1;
|
||||
int i6 = 0;
|
||||
int l6 = 1;
|
||||
boolean flag = false;
|
||||
int k7 = random.nextInt(100);
|
||||
int j8 = random.nextInt(100);
|
||||
int j5;
|
||||
if (j8 <= 20) {
|
||||
j5 = 0;
|
||||
} else {
|
||||
j5 = random.nextInt(4) + 5;
|
||||
}
|
||||
setBlock(world, j1, k1 - j5, l1, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 1, l1, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, (k1 - j5) + 2, l1, Blocks.stonebrick);
|
||||
setBlock(world, j1, (k1 - j5) + 4, l1 + 1, Blocks.stonebrick);
|
||||
setBlock(world, j1, (k1 - j5) + 3, l1 + 2, Blocks.stonebrick);
|
||||
setBlock(world, j1, (k1 - j5) + 1, l1 + 3, Blocks.stonebrick);
|
||||
setBlock(world, j1, (k1 - j5) + 2, l1 + 3, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1, k1 - j5, l1 + 3, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 1, l1, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 2, l1 + 1, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 3, l1 + 1, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, (k1 - j5) + 4, l1 + 1, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 5, l1 + 1, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 2, l1 + 2, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, (k1 - j5) + 3, l1 + 2, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1, (k1 - j5) + 4, l1 + 2, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1, k1 - j5, l1 + 3, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, (k1 - j5) + 1, l1 + 3, Blocks.stonebrick);
|
||||
setBlock(world, j1, (k1 - j5) + 2, l1 + 3, Blocks.stonebrick);
|
||||
setBlock(world, j1, k1 - j5 - k4 - 1, l1 + 2, Blocks.dirt);
|
||||
setBlock(world, j1, k1 - j5 - k4, l1 + 2, Blocks.chest);
|
||||
ChestFiller.fillWithValuables(world.getTileEntity(j1, k1 - j5 - k4, l1 + 2));
|
||||
l6 = 1;
|
||||
i6 = 0;
|
||||
flag = false;
|
||||
int l6 = 1;
|
||||
int i6 = 0;
|
||||
boolean flag = false;
|
||||
do {
|
||||
if (world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) || world.isAirBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 6)
|
||||
|| world.getBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 4) == Blocks.water || world.getBlock(j1 + l3, k1 - j5 - l6, l1 + l3 + 5) == Blocks.water
|
||||
|
|
@ -69,21 +65,21 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
}
|
||||
} while (!flag && l6++ < 12);
|
||||
setBlock(world, j1 + l3, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick);
|
||||
setBlock(world, j1 + l3 + 2, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick);
|
||||
setBlock(world, j1 + l3 + 5, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick);
|
||||
setBlock(world, j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 5, Blocks.stonebrick);
|
||||
setBlock(world, j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 + l3 + 1, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 + l3 + 1, ((k1 - j5) + 1) - i6, l1 + l3 + 4, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 + l3 + 2, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1 + l3 + 3, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 + l3 + 4, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 + l3 + 5, k1 - j5 - i6, l1 + l3 + 4, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1 + l3, k1 - j5 - i6, l1 + l3 + 5, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 5, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 6, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 + l3, ((k1 - j5) + 3) - i6, l1 + l3 + 6, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 + l3, k1 - j5 - i6, l1 + l3 + 7, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 + l3, ((k1 - j5) + 1) - i6, l1 + l3 + 7, Blocks.stonebrick);
|
||||
setBlockAndMetadata(world, j1 + l3, ((k1 - j5) + 2) - i6, l1 + l3 + 7, Blocks.stonebrick, 1);
|
||||
k7 = random.nextInt(100);
|
||||
int k7 = random.nextInt(100);
|
||||
if (k7 <= 30) {
|
||||
setBlock(world, j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5, Blocks.mob_spawner);
|
||||
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getTileEntity(j1 + l3, k1 - j5 - i6 - k4, l1 + l3 + 5);
|
||||
|
|
@ -122,12 +118,8 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
int j3 = random.nextInt(8) + 5;
|
||||
int i4 = random.nextInt(8) + 5;
|
||||
int l4 = random.nextInt(4) + 3;
|
||||
int k5 = 1;
|
||||
int j6 = 0;
|
||||
int i7 = 1;
|
||||
boolean flag1 = false;
|
||||
int l7 = random.nextInt(100);
|
||||
int k8 = random.nextInt(100);
|
||||
int k5;
|
||||
if (k8 <= 20) {
|
||||
k5 = 0;
|
||||
} else {
|
||||
|
|
@ -146,9 +138,9 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
setBlockAndMetadata(world, j1 + 2, k1 - k5, l1, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, k1 - k5 - l4, l1 + 2, Blocks.dirt);
|
||||
setBlock(world, j1, k1 - k5 - l4 - 1, l1 + 2, Blocks.dirt);
|
||||
i7 = 1;
|
||||
j6 = 0;
|
||||
flag1 = false;
|
||||
int i7 = 1;
|
||||
int j6 = 0;
|
||||
boolean flag1 = false;
|
||||
do {
|
||||
if (world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 4) || world.isAirBlock(j1 - k2, k1 - k5 - i7, l1 - 5) || world.isAirBlock(j1 - k2 - 1, k1 - k5 - i7, l1 - 5)
|
||||
|| world.getBlock(j1 - k2, k1 - k5 - i7, l1 - 4) == Blocks.water || world.getBlock(j1 - k2, k1 - k5 - i7, l1 - 5) == Blocks.water
|
||||
|
|
@ -171,7 +163,7 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
setBlockAndMetadata(world, j1 - k2 - 1, ((k1 - k5) + 1) - j6, l1 - 5, Blocks.stonebrick, 1);
|
||||
setBlockAndMetadata(world, j1 - k2 - 1, ((k1 - k5) + 2) - j6, l1 - 5, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 - k2 - 2, k1 - k5 - j6, l1 - 5, Blocks.stonebrick);
|
||||
l7 = random.nextInt(100);
|
||||
int l7 = random.nextInt(100);
|
||||
if (l7 <= 30) {
|
||||
setBlock(world, j1 - k2 - 1, k1 - k5 - j6 - l4, l1 - 5, Blocks.dirt);
|
||||
setBlock(world, j1 - k2 - 1, k1 - k5 - j6 - l4 - 1, l1 - 5, Blocks.dirt);
|
||||
|
|
@ -279,12 +271,8 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
int k3 = random.nextInt(8) + 5;
|
||||
int j4 = random.nextInt(8) + 5;
|
||||
int i5 = random.nextInt(4) + 3;
|
||||
int l5 = 1;
|
||||
int k6 = 0;
|
||||
int j7 = 1;
|
||||
boolean flag2 = false;
|
||||
int i8 = random.nextInt(100);
|
||||
int l8 = random.nextInt(100);
|
||||
int l5;
|
||||
if (l8 <= 20) {
|
||||
l5 = 0;
|
||||
} else {
|
||||
|
|
@ -306,9 +294,9 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
setBlockAndMetadata(world, j1, (k1 - l5) + 1, l1 + 2, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1, k1 - l5 - i5, l1 + 1, Blocks.dirt);
|
||||
setBlock(world, j1, k1 - l5 - i5 - 1, l1 + 1, Blocks.dirt);
|
||||
j7 = 1;
|
||||
k6 = 0;
|
||||
flag2 = false;
|
||||
int j7 = 1;
|
||||
int k6 = 0;
|
||||
boolean flag2 = false;
|
||||
do {
|
||||
if (world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) || world.isAirBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 4)
|
||||
|| world.getBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 2) == Blocks.water || world.getBlock(j1 + k3 + l2, k1 - l5 - j7, l1 + j4 + 3) == Blocks.water
|
||||
|
|
@ -334,7 +322,7 @@ public class StructureRuin$1 extends WorldGenerator {
|
|||
setBlockAndMetadata(world, j1 + k3 + l2, ((k1 - l5) + 1) - k6, l1 + j4 + 3, Blocks.stonebrick, 1);
|
||||
setBlock(world, j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 4, Blocks.stonebrick);
|
||||
setBlock(world, j1 + k3 + l2, k1 - l5 - k6, l1 + j4 + 6, Blocks.stonebrick);
|
||||
i8 = random.nextInt(100);
|
||||
int i8 = random.nextInt(100);
|
||||
if (i8 <= 30) {
|
||||
setBlock(world, j1 + k3 + l2, k1 - l5 - k6 - i5, l1 + j4 + 1, Blocks.dirt);
|
||||
setBlock(world, j1 + k3 + l2, k1 - l5 - k6 - i5 - 1, l1 + j4 + 1, Blocks.dirt);
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ public class WorldGenMystic implements IWorldGenerator {
|
|||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
|
||||
if (Config.allowId[0].contains(world.provider.dimensionId)) {
|
||||
if (Config.RuinRarity>0 && Config.allowId[0].contains(world.provider.dimensionId)) {
|
||||
generateRuins(world, random, chunkX * 16, chunkZ * 16);
|
||||
}
|
||||
if (world.getWorldInfo().getTerrainType() == WorldType.FLAT) {
|
||||
return;
|
||||
}
|
||||
if (Config.allowId[1].contains(world.provider.dimensionId)) {
|
||||
if (Config.DunRarity>0 && Config.allowId[1].contains(world.provider.dimensionId)) {
|
||||
generateDungeon(world, random, chunkX * 16, chunkZ * 16);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,30 +32,34 @@ public class WorldGenMystic implements IWorldGenerator {
|
|||
private void generateDungeon(World world, Random random, int blockX, int blockZ) {
|
||||
int Xcoord1, Ycoord1, Zcoord1;
|
||||
BiomeGenBase biome;
|
||||
for (int i = 0; i < Config.DunRarity; i++) {
|
||||
Xcoord1 = blockX + random.nextInt(16) + 8;
|
||||
Ycoord1 = random.nextInt(9) + 28;
|
||||
Zcoord1 = blockZ + random.nextInt(16) + 8;
|
||||
biome = world.getBiomeGenForCoords(Xcoord1, Zcoord1);
|
||||
if (Config.allowId[3].contains(biome.biomeID) && Config.allowType[1].containsAll(Arrays.asList(BiomeDictionary.getTypesForBiome(biome)))) {
|
||||
if (dungeon.generate(world, random, Xcoord1, Ycoord1, Zcoord1))
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i-Config.DunRarity/100<0F; i++) {
|
||||
if(random.nextInt(Config.DunRarity)>1){
|
||||
Xcoord1 = blockX + random.nextInt(16) + 8;
|
||||
Ycoord1 = random.nextInt(9) + 28;
|
||||
Zcoord1 = blockZ + random.nextInt(16) + 8;
|
||||
biome = world.getBiomeGenForCoords(Xcoord1, Zcoord1);
|
||||
if (Config.allowId[3].contains(biome.biomeID) && Config.allowType[1].containsAll(Arrays.asList(BiomeDictionary.getTypesForBiome(biome)))) {
|
||||
if (dungeon.generate(world, random, Xcoord1, Ycoord1, Zcoord1))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void generateRuins(World world, Random random, int blockX, int blockZ) {
|
||||
int Xcoord1, Ycoord1, Zcoord1;
|
||||
BiomeGenBase biome;
|
||||
for (int i = 0; i < Config.RuinRarity; i++) {
|
||||
Xcoord1 = blockX + random.nextInt(16) + 8;
|
||||
Ycoord1 = random.nextInt(11) + 60;
|
||||
Zcoord1 = blockZ + random.nextInt(16) + 8;
|
||||
biome = world.getBiomeGenForCoords(Xcoord1, Zcoord1);
|
||||
if (Config.allowId[2].contains(biome.biomeID) && Config.allowType[0].containsAll(Arrays.asList(BiomeDictionary.getTypesForBiome(biome)))) {
|
||||
if (ruin.generate(world, random, Xcoord1, Ycoord1, Zcoord1) || ruin1.generate(world, random, Xcoord1, Ycoord1, Zcoord1))
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i-Config.RuinRarity/100<0F; i++) {
|
||||
if(random.nextInt(Config.RuinRarity)>1){
|
||||
Xcoord1 = blockX + random.nextInt(16) + 8;
|
||||
Ycoord1 = random.nextInt(11) + 60;
|
||||
Zcoord1 = blockZ + random.nextInt(16) + 8;
|
||||
biome = world.getBiomeGenForCoords(Xcoord1, Zcoord1);
|
||||
if (Config.allowId[2].contains(biome.biomeID) && Config.allowType[0].containsAll(Arrays.asList(BiomeDictionary.getTypesForBiome(biome)))) {
|
||||
if (ruin.generate(world, random, Xcoord1, Ycoord1, Zcoord1) || ruin1.generate(world, random, Xcoord1, Ycoord1, Zcoord1))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue