diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-07 21:05:04 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-07 21:05:04 +1000 |
commit | 6203953e6e44c46188b4517bbbcda36f0235853f (patch) | |
tree | f64148c10181757600602e8087cc3c5fbddd51a1 /src/Java/gtPlusPlus/australia | |
parent | 25c4b00360fd6448f2c8283051434271f05b1735 (diff) | |
download | GT5-Unofficial-6203953e6e44c46188b4517bbbcda36f0235853f.tar.gz GT5-Unofficial-6203953e6e44c46188b4517bbbcda36f0235853f.tar.bz2 GT5-Unofficial-6203953e6e44c46188b4517bbbcda36f0235853f.zip |
+ Added Large Ravines to Australia.
% Trying to learn more about World Gen.
Diffstat (limited to 'src/Java/gtPlusPlus/australia')
3 files changed, 441 insertions, 53 deletions
diff --git a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java index 7c36c76489..a7622028e2 100644 --- a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java +++ b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java @@ -9,10 +9,10 @@ import java.util.Random; import cpw.mods.fml.common.eventhandler.Event.Result; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.australia.block.AustraliaContentLoader; -import gtPlusPlus.australia.gen.map.MapGenExtendedVillage; -import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.australia.gen.map.MapGenLargeRavine; +import gtPlusPlus.australia.gen.map.MapGenVillageLogging; import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; @@ -22,6 +22,7 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.*; +import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenScatteredFeature; @@ -32,7 +33,7 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.TerrainGen; -public class ChunkProviderAustralia implements IChunkProvider { +public class ChunkProviderAustralia extends ChunkProviderGenerate implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; @@ -65,7 +66,7 @@ public class ChunkProviderAustralia implements IChunkProvider { /** * Holds Village Generator */ - private MapGenVillage villageGenerator = new MapGenVillage(); + private MapGenVillageLogging villageGenerator = new MapGenVillageLogging(); /** * Holds Mineshaft Generator */ @@ -74,7 +75,7 @@ public class ChunkProviderAustralia implements IChunkProvider { /** * Holds ravine generator */ - private MapGenBase ravineGenerator = new MapGenRavine(); + private MapGenBase ravineGenerator = new MapGenLargeRavine(); /** * The biomes that are used to generate the chunk */ @@ -128,7 +129,7 @@ public class ChunkProviderAustralia implements IChunkProvider { }*/ - villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, + villageGenerator = (MapGenVillageLogging) TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); @@ -141,6 +142,7 @@ public class ChunkProviderAustralia implements IChunkProvider { } public ChunkProviderAustralia(World par1World, long par2) { + super(par1World, par2, true); this.worldObj = par1World; this.worldType = par1World.getWorldInfo().getTerrainType(); this.rand = new Random(par2); @@ -260,30 +262,6 @@ public class ChunkProviderAustralia implements IChunkProvider { } /** - * Will return back a chunk, if it doesn't exist and its not a MP client - * it will generates all the blocks for the specified chunk from the map - * seed and chunk seed - */ - /*@Override - public Chunk provideChunk(int par1, int par2) { - this.rand.setSeed(par1 * 341873128712L + par2 * 132897987541L); - Block[] ablock = new Block[65536]; - byte[] abyte = new byte[65536]; - func_147424_a(par1, par2, ablock); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); - - replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration); - - Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2); - byte[] abyte1 = chunk.getBiomeArray(); - for (int k = 0; k < abyte1.length; k++) { - abyte1[k] = ((byte)this.biomesForGeneration[k].biomeID); - } - chunk.generateSkylightMap(); - return chunk; - }*/ - - /** * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the * specified chunk from the map seed and chunk seed */ @@ -301,8 +279,14 @@ public class ChunkProviderAustralia implements IChunkProvider { caveGenerator.func_151539_a(this, worldObj, x, z, ablock); ravineGenerator.func_151539_a(this, worldObj, x, z, ablock); ravineGenerator.func_151539_a(this, worldObj, x, z, ablock); + ravineGenerator.func_151539_a(this, worldObj, x, z, ablock); + ravineGenerator.func_151539_a(this, worldObj, x, z, ablock); villageGenerator.func_151539_a(this, worldObj, x, z, ablock); scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock); + scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock); + scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock); + scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock); + scatteredFeatureGenerator.func_151539_a(this, worldObj, x, z, ablock); mineshaftGenerator.func_151539_a(this, worldObj, x, z, ablock); Chunk chunk = new Chunk(worldObj, ablock, abyte, x, z); @@ -587,7 +571,7 @@ public class ChunkProviderAustralia implements IChunkProvider { */ @Override public boolean chunkExists(int par1, int par2) { - return true; + return super.chunkExists(par1, par2); } /** @@ -595,7 +579,104 @@ public class ChunkProviderAustralia implements IChunkProvider { */ @Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { - net.minecraft.block.BlockFalling.fallInstantly = false; + + boolean generateStructures = true; + + BlockFalling.fallInstantly = true; + int x = par2 * 16; + int z = par3 * 16; + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); + this.rand.setSeed(this.worldObj.getSeed()); + long i1 = this.rand.nextLong() / 2L * 2L + 1L; + long j1 = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed()); + boolean flag = false; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + + if (generateStructures) { + this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + } + + int k1; + int l1; + int i2; + + + if (generateStructures) { + if (generateStructures) { + // No specific liquid dimlets specified: we generate default lakes (water and lava were appropriate). + if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 + && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) { + k1 = x + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(256); + i2 = z + this.rand.nextInt(16) + 8; + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2); + } + + if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA) && !flag && this.rand.nextInt(8) == 0) { + k1 = x + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); + i2 = z + this.rand.nextInt(16) + 8; + + if (l1 < 63 || this.rand.nextInt(10) == 0) { + (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2); + } + } + } /*else { + // Generate lakes for the specified biomes. + for (Block liquid : dimensionInformation.getFluidsForLakes()) { + if (!flag && this.rand.nextInt(4) == 0 + && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) { + k1 = x + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(256); + i2 = z + this.rand.nextInt(16) + 8; + (new WorldGenLakes(liquid)).generate(this.worldObj, this.rand, k1, l1, i2); + } + } + }*/ + } + + boolean doGen = false; + if (generateStructures) { + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); + for (k1 = 0; doGen && k1 < 8; ++k1) { + l1 = x + this.rand.nextInt(16) + 8; + i2 = this.rand.nextInt(256); + int j2 = z + this.rand.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2); + } + } + + biomegenbase.decorate(this.worldObj, this.rand, x, z); + if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand); + } + x += 8; + z += 8; + + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); + for (k1 = 0; doGen && k1 < 16; ++k1) { + for (l1 = 0; l1 < 16; ++l1) { + i2 = this.worldObj.getPrecipitationHeight(x + k1, z + l1); + + if (this.worldObj.isBlockFreezable(k1 + x, i2 - 1, l1 + z)) { + this.worldObj.setBlock(k1 + x, i2 - 1, l1 + z, Blocks.ice, 0, 2); + } + + if (this.worldObj.func_147478_e(k1 + x, i2, l1 + z, true)) { + this.worldObj.setBlock(k1 + x, i2, l1 + z, Blocks.snow_layer, 0, 2); + } + } + } + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + + BlockFalling.fallInstantly = false; + //super.populate(par1IChunkProvider, par2, par3); + /*net.minecraft.block.BlockFalling.fallInstantly = false; int k = par2 * 16; int l = par3 * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); @@ -607,18 +688,17 @@ public class ChunkProviderAustralia implements IChunkProvider { MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag)); - if (true) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - if (flag) { - Logger.INFO("Did Generate? "+flag); - } - else { - //Logger.INFO("Can village spawn here? "+villageGenerator.villageSpawnBiomes.contains(biomegenbase)); - } + + this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + if (flag) { + Logger.INFO("Did Generate? "+flag); } + else { + //Logger.INFO("Can village spawn here? "+villageGenerator.villageSpawnBiomes.contains(biomegenbase)); + } + if ((biomegenbase != BiomeGenBase.desert) && (biomegenbase != BiomeGenBase.desertHills) && (!flag)) { if ((this.rand.nextInt(4) == 0) && @@ -654,7 +734,7 @@ public class ChunkProviderAustralia implements IChunkProvider { MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, this.worldObj, this.rand, par2, par3, flag)); - net.minecraft.block.BlockFalling.fallInstantly = false; + net.minecraft.block.BlockFalling.fallInstantly = false;*/ } /** @@ -664,7 +744,7 @@ public class ChunkProviderAustralia implements IChunkProvider { */ @Override public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { - return true; + return super.saveChunks(par1, par2IProgressUpdate); } /** @@ -681,7 +761,7 @@ public class ChunkProviderAustralia implements IChunkProvider { */ @Override public boolean unloadQueuedChunks() { - return false; + return super.unloadQueuedChunks(); } /** @@ -689,7 +769,7 @@ public class ChunkProviderAustralia implements IChunkProvider { */ @Override public boolean canSave() { - return true; + return super.canSave(); } /** @@ -716,6 +796,7 @@ public class ChunkProviderAustralia implements IChunkProvider { @Override public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) { Logger.INFO("func_147416_a: "+p_147416_2_); + //return super.func_147416_a(p_147416_1_, p_147416_2_, p_147416_3_, p_147416_4_, p_147416_5_); return "ExtendedVillage".equals(p_147416_2_) && this.villageGenerator != null ? @@ -726,15 +807,15 @@ public class ChunkProviderAustralia implements IChunkProvider { @Override public int getLoadedChunkCount() { - return 0; + return super.getLoadedChunkCount(); } @Override public void recreateStructures(int par1, int par2) { - //Logger.INFO("Recreating Structs"); - this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); - this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); - this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); + //super.recreateStructures(par1, par2); + this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); + this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); + this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java new file mode 100644 index 0000000000..ef49155dad --- /dev/null +++ b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java @@ -0,0 +1,243 @@ +package gtPlusPlus.australia.gen.map; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Random; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.block.Block; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.MapGenRavine; + +public class MapGenLargeRavine extends MapGenRavine +{ + private float[] field_75046_d = new float[1024]; + + @Override + protected void func_151540_a(long aSeed, int var1, int var2, Block[] aBlocksInChunkOrPassedIn, double p_151540_6_, double p_151540_8_, double p_151540_10_, float p_151540_12_, float p_151540_13_, float p_151540_14_, int p_151540_15_, int p_151540_16_, double p_151540_17_) + { + Logger.INFO("Generating Large Ravine."); + Random random = new XSTR(aSeed); + double d4 = (double)(var1 * 32 + 16); + double d5 = (double)(var2 * 32 + 16); + float f3 = 0.0F; + float f4 = 0.0F; + + if (p_151540_16_ <= 0) + { + int j1 = this.range * 16 - 16; + p_151540_16_ = j1 - random.nextInt(j1 / 4); + } + + boolean flag1 = false; + + if (p_151540_15_ == -1) + { + p_151540_15_ = p_151540_16_ / 2; + flag1 = true; + } + + float f5 = 1.0F; + + for (int k1 = 0; k1 < 256; ++k1) + { + if (k1 == 0 || random.nextInt(3) == 0) + { + f5 = 1.0F + random.nextFloat() * random.nextFloat() * 1.0F; + } + + this.field_75046_d[k1] = f5 * f5; + } + + for (; p_151540_15_ < p_151540_16_; ++p_151540_15_) + { + double d12 = 3.5D + (double)(MathHelper.sin((float)p_151540_15_ * CORE.PI / (float)p_151540_16_) * p_151540_12_ * 1.0F); + double d6 = d12 * p_151540_17_; + d12 *= (double)random.nextFloat() * 0.55D + 0.75D; + d6 *= (double)random.nextFloat() * 0.55D + 0.75D; + float f6 = MathHelper.cos(p_151540_14_); + float f7 = MathHelper.sin(p_151540_14_); + p_151540_6_ += (double)(MathHelper.cos(p_151540_13_) * f6); + p_151540_8_ += (double)f7; + p_151540_10_ += (double)(MathHelper.sin(p_151540_13_) * f6); + p_151540_14_ *= 1.7F; + p_151540_14_ += f4 * 0.25F; + p_151540_13_ += f3 * 0.25F; + f4 *= 0.8F; + f3 *= 0.5F; + f4 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; + f3 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; + + if (flag1 || random.nextInt(4) != 0) + { + double d7 = p_151540_6_ - d4; + double d8 = p_151540_10_ - d5; + double d9 = (double)(p_151540_16_ - p_151540_15_); + double d10 = (double)(p_151540_12_ + 2.0F + 16.0F); + + if (d7 * d7 + d8 * d8 - d9 * d9 > d10 * d10) + { + return; + } + + if (p_151540_6_ >= d4 - 16.0D - d12 * 2.0D && p_151540_10_ >= d5 - 16.0D - d12 * 2.0D && p_151540_6_ <= d4 + 16.0D + d12 * 2.0D && p_151540_10_ <= d5 + 16.0D + d12 * 2.0D) + { + int i4 = MathHelper.floor_double(p_151540_6_ - d12) - var1 * 16 - 1; + int l1 = MathHelper.floor_double(p_151540_6_ + d12) - var1 * 16 + 1; + int j4 = MathHelper.floor_double(p_151540_8_ - d6) - 1; + int i2 = MathHelper.floor_double(p_151540_8_ + d6) + 1; + int k4 = MathHelper.floor_double(p_151540_10_ - d12) - var2 * 16 - 1; + int j2 = MathHelper.floor_double(p_151540_10_ + d12) - var2 * 16 + 1; + + if (i4 < 0) + { + i4 = 0; + } + + if (l1 > 16) + { + l1 = 16; + } + + if (j4 < 1) + { + j4 = 1; + } + + if (i2 > 248) + { + i2 = 248; + } + + if (k4 < 0) + { + k4 = 0; + } + + if (j2 > 16) + { + j2 = 16; + } + + boolean flag2 = false; + int k2; + int j3; + + for (k2 = i4; !flag2 && k2 < l1; ++k2) + { + for (int l2 = k4; !flag2 && l2 < j2; ++l2) + { + for (int i3 = i2 + 1; !flag2 && i3 >= j4 - 1; --i3) + { + j3 = (k2 * 16 + l2) * 256 + i3; + + if (i3 >= 0 && i3 < 256) + { + Block block = aBlocksInChunkOrPassedIn[j3]; + + if (isOceanBlock(aBlocksInChunkOrPassedIn, j3, k2, i3, l2, var1, var2)) + { + flag2 = true; + } + + if (i3 != j4 - 1 && k2 != i4 && k2 != l1 - 1 && l2 != k4 && l2 != j2 - 1) + { + i3 = j4; + } + } + } + } + } + + if (!flag2) + { + for (k2 = i4; k2 < l1; ++k2) + { + double d13 = ((double)(k2 + var1 * 16) + 0.5D - p_151540_6_) / d12; + + for (j3 = k4; j3 < j2; ++j3) + { + double d14 = ((double)(j3 + var2 * 16) + 0.5D - p_151540_10_) / d12; + int k3 = (k2 * 16 + j3) * 256 + i2; + boolean flag = false; + + if (d13 * d13 + d14 * d14 < 1.0D) + { + for (int l3 = i2 - 1; l3 >= j4; --l3) + { + double d11 = ((double)l3 + 0.5D - p_151540_8_) / d6; + + if ((d13 * d13 + d14 * d14) * (double)this.field_75046_d[l3] + d11 * d11 / 6.0D < 1.0D) + { + Block block1 = aBlocksInChunkOrPassedIn[k3]; + + if (checkIfTopBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2)) + { + flag = true; + } + + digBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2, flag); + } + + --k3; + } + } + } + } + + if (flag1) + { + break; + } + } + } + } + } + } + + + //generate? + @Override + protected void func_151538_a(World p_151538_1_, int p_151538_2_, int p_151538_3_, int chunkX, int chunkZ, Block[] blocks) + { + if (this.rand.nextInt(50) == 0) + { + double d0 = (double)(p_151538_2_ * 16 + this.rand.nextInt(16)); + double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20); + double d2 = (double)(p_151538_3_ * 16 + this.rand.nextInt(16)); + byte b0 = 1; + + for (int i1 = 0; i1 < b0; ++i1) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F; + this.func_151540_a(this.rand.nextLong(), chunkX, chunkZ, blocks, d0, d1, d2, f2, f, f1, 0, 0, 3.0D); + } + } + } + + private static Method isTopBlock; + + //Determine if the block at the specified location is the top block for the biome, we take into account + private synchronized boolean checkIfTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ){ + try { + if (isTopBlock == null) { + isTopBlock = MapGenRavine.class.getDeclaredMethod("isTopBlock", Block[].class, int.class, int.class, int.class, int.class, int.class, int.class); + } + if (isTopBlock != null) { + return (boolean) isTopBlock.invoke(this, data, index, x, y, z, chunkX, chunkZ); + } + else { + return false; + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException n) { + return false; + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java b/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java new file mode 100644 index 0000000000..fd5c8df5b2 --- /dev/null +++ b/src/Java/gtPlusPlus/australia/gen/map/MapGenVillageLogging.java @@ -0,0 +1,64 @@ +package gtPlusPlus.australia.gen.map; + +import java.util.Map; +import java.util.Random; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenVillage; +import net.minecraft.world.gen.structure.StructureStart; + +public class MapGenVillageLogging extends MapGenVillage { + + public MapGenVillageLogging() { + super(); + } + + public MapGenVillageLogging(Map p_i2093_1_) { + super(p_i2093_1_); + } + + @Override + public String func_143025_a() { + return super.func_143025_a(); + } + + @Override + protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) { + + return super.canSpawnStructureAtCoords(p_75047_1_, p_75047_2_); + } + + @Override + protected StructureStart getStructureStart(int p_75049_1_, int p_75049_2_) { + return new MapGenVillageLogging.Start(this.worldObj, this.rand, p_75049_1_, p_75049_2_, 0); + } + + public static class StartLogging extends Start { + /** well ... thats what it does */ + private boolean hasMoreThanTwoComponents; + private static final String __OBFID = "CL_00000515"; + + public StartLogging() { + } + + public StartLogging(World p_i2092_1_, Random p_i2092_2_, int p_i2092_3_, int p_i2092_4_, int p_i2092_5_) { + super(p_i2092_1_, p_i2092_2_, p_i2092_3_, p_i2092_4_, p_i2092_5_); + } + + /** + * currently only defined for Villages, returns true if Village has more than 2 + * non-road components + */ + public boolean isSizeableStructure() { + return this.hasMoreThanTwoComponents; + } + + public void func_143022_a(NBTTagCompound p_143022_1_) { + super.func_143022_a(p_143022_1_); + } + + public void func_143017_b(NBTTagCompound p_143017_1_) { + super.func_143017_b(p_143017_1_); + } + } +}
\ No newline at end of file |