diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenTropicalRainforest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenTropicalRainforest.java index 5c2fc610d..5f5065092 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenTropicalRainforest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenTropicalRainforest.java @@ -1,99 +1,131 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.configuration.BOPConfigurationMisc; +import biomesoplenty.common.entities.EntityJungleSpider; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.WorldGenRainforestTree1; public class BiomeGenTropicalRainforest extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.7F); - @SuppressWarnings("unchecked") - public BiomeGenTropicalRainforest(int par1) + public BiomeGenTropicalRainforest(int id) { - super(par1); - /* - spawnableMonsterList.add(new SpawnListEntry(EntityOcelot.class, 2, 1, 1)); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP) theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 12; - customBiomeDecorator.grassPerChunk = 9; - customBiomeDecorator.highGrassPerChunk = 4; - customBiomeDecorator.reedsPerChunk = 10; - customBiomeDecorator.waterlilyPerChunk = 2; - customBiomeDecorator.orangeFlowersPerChunk = 10; - customBiomeDecorator.generatePumpkins = false; - customBiomeDecorator.generateMelons = true; - customBiomeDecorator.sproutsPerChunk = 2; - customBiomeDecorator.generateQuicksand = true; - customBiomeDecorator.poisonIvyPerChunk = 4; - customBiomeDecorator.lilyflowersPerChunk = 2; - customBiomeDecorator.shrubsPerChunk = 15; - customBiomeDecorator.wheatGrassPerChunk = 5; - spawnableMonsterList.add(new SpawnListEntry(EntityJungleSpider.class, 12, 6, 6)); - waterColorMultiplier = 6160128; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(8970560); + this.setTemperatureRainfall(1.2F, 0.9F); + + this.spawnableMonsterList.add(new SpawnListEntry(EntityOcelot.class, 2, 1, 1)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityJungleSpider.class, 12, 6, 6)); + + this.waterColorMultiplier = 6160128; + + this.theBiomeDecorator.treesPerChunk = 12; + this.theBiomeDecorator.grassPerChunk = 9; + this.theBiomeDecorator.reedsPerChunk = 10; + this.theBiomeDecorator.waterlilyPerChunk = 2; + + this.bopWorldFeatures.bopFlowersPerChunk = 10; + this.bopWorldFeatures.doubleTallGrassPerChunk = 4; + this.bopWorldFeatures.generatePumpkins = false; + this.bopWorldFeatures.generateMelons = true; + this.bopWorldFeatures.sproutsPerChunk = 2; + this.bopWorldFeatures.generateQuicksand = true; + this.bopWorldFeatures.poisonIvyPerChunk = 4; + this.bopWorldFeatures.shrubsPerChunk = 15; + } + + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(5) == 0 ? new WorldGenTrees(false, 4 + random.nextInt(7), 3, 3, true) : + new WorldGenRainforestTree1(Blocks.log, Blocks.leaves, 3, 3, false, 8, 8); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 5), 1D); + + return flowerMap; + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; } - /* @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) + public void decorate(World world, Random random, int chunkX, int chunkZ) { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); for (int var6 = 0; var6 < var5; ++var6) { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); - Block block = Block.blocksList[var10]; - if (block != null - && block.isGenMineableReplaceable(par1World, var7, var8, - var9, Block.stone.blockID)) + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) { - par1World.setBlock(var7, var8, var9, - Blocks.amethystOre.get().blockID, 6, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 6, 2); } } } - */ - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(5) == 0 ? new WorldGenTrees(false, - 4 + par1Random.nextInt(7), 3, 3, true) - : new WorldGenRainforest1(false); - } - */ - - /** - * Provides the basic grass color based on the biome temperature and - * rainfall - */ - /* - @Override - public int getBiomeGrassColor() + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) { return 11002176; } - */ - /** - * Provides the basic foliage color based on the biome temperature and - * rainfall - */ - /* + @Override - public int getBiomeFoliageColor() + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) { return 8970560; } - */ + + @Override + public int getSkyColorByTemp(float par1) + { + if (BOPConfigurationMisc.skyColors) return 11128415; + else return super.getSkyColorByTemp(par1); + } /** * Fog Color @@ -106,37 +138,7 @@ public class BiomeGenTropicalRainforest extends BOPBiome } */ - /** - * takes temperature, returns color - */ - /* - @Override - public int getSkyColorByTemp(float par1) - { - if (BOPConfigurationMisc.skyColors) - { - return 11128415; - } - else - { - par1 /= 3.0F; - - if (par1 < -1.0F) - { - par1 = -1.0F; - } - - if (par1 > 1.0F) - { - par1 = 1.0F; - } - - return Color.getHSBColor(0.62222224F - par1 * 0.05F, - 0.5F + par1 * 0.1F, 1.0F).getRGB(); - } - } - - @Override + /*@Override public float getFogCloseness() { // TODO Auto-generated method stub diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java index a573b80d5..0da0cd2a3 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java @@ -1,94 +1,112 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenTundra extends BOPBiome { + private static final Height biomeHeight = new Height(0.1F, 0.3F); + + public BiomeGenTundra(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(11371606); + this.setTemperatureRainfall(0.2F, 0.8F); - public BiomeGenTundra(int par1) - { - super(par1); - /* - spawnableCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 5; - customBiomeDecorator.grassPerChunk = 8; - customBiomeDecorator.wheatGrassPerChunk = 3; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.reedsPerChunk = -999; - customBiomeDecorator.gravelPerChunk = 8; - customBiomeDecorator.gravelPerChunk2 = 8; - customBiomeDecorator.shrubsPerChunk = 2; - customBiomeDecorator.waterReedsPerChunk = 2; - customBiomeDecorator.violetsPerChunk = 1; - */ - } - - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + this.spawnableCreatureList.clear(); - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + this.theBiomeDecorator.treesPerChunk = 5; + this.theBiomeDecorator.grassPerChunk = 8; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.reedsPerChunk = -999; + this.theBiomeDecorator.sandPerChunk = 8; - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 8, 2); - } - } - } - */ + this.bopWorldFeatures.bopFlowersPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 2; + this.bopWorldFeatures.rockpilesPerChunk = 25; + } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new WorldGenShrub(0,0) : new WorldGenTundra1(); - } - */ + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return new WorldGenShrub(0, 0); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 1D); + + return flowerMap; + } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new WorldGenTallGrass(Blocks.foliage.get().blockID, 2) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 1); - } - */ + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 1), 1D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + + return grassMap; + } - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeGrassColor() - { - return 11371606; - } - */ + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeFoliageColor() - { - return 12543566; - } - */ + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 8, 2); + } + } + } + + @Override + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) + { + return 11371606; + } + + @Override + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) + { + return 12543566; + } } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index f278caa04..b2c55ade0 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -53,6 +53,8 @@ import biomesoplenty.common.biomes.BiomeGenShrubland; import biomesoplenty.common.biomes.BiomeGenSpruceWoods; import biomesoplenty.common.biomes.BiomeGenThicket; import biomesoplenty.common.biomes.BiomeGenTimber; +import biomesoplenty.common.biomes.BiomeGenTropicalRainforest; +import biomesoplenty.common.biomes.BiomeGenTundra; import biomesoplenty.common.configuration.BOPConfigurationIDs; import biomesoplenty.common.world.WorldTypeBOP; @@ -142,14 +144,14 @@ public class BOPBiomes registerBiome(new BOPBiomeListEntry(new BiomeGenShield(BOPConfigurationIDs.shieldID).setBiomeName("Shield"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenShrubland(BOPConfigurationIDs.shrublandID).setBiomeName("Shrubland"), BOPBiomeTemperatureType.COOL)); //registerBiome(new BOPBiomeListEntry(new BiomeGenSilkglades(BOPConfigurationIDs.silkgladesID).setBiomeName("Silkglades"), BOPBiomeTemperatureType.COOL)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenSludgepit(BOPConfigurationIDs.sludgepitID).setBiomeName("Sludgepit"), BOPBiomeTemperatureType.WARM));*/ - registerOnlyBiome(new BOPBiomeListEntry(new BiomeGenSpruceWoods(BOPConfigurationIDs.spruceWoodsID).setBiomeName("Spruce Woods"), BOPBiomeTemperatureType.WARM)); + //registerBiome(new BOPBiomeListEntry(new BiomeGenSludgepit(BOPConfigurationIDs.sludgepitID).setBiomeName("Sludgepit"), BOPBiomeTemperatureType.WARM)); + registerBiome(new BOPBiomeListEntry(new BiomeGenSpruceWoods(BOPConfigurationIDs.spruceWoodsID).setBiomeName("Spruce Woods"), BOPBiomeTemperatureType.WARM)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenTemperateRainforest(BOPConfigurationIDs.temperateRainforestID).setBiomeName("Temperate Rainforest"), BOPBiomeTemperatureType.WARM));*/ registerBiome(new BOPBiomeListEntry(new BiomeGenThicket(BOPConfigurationIDs.thicketID).setBiomeName("Thicket"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenTimber(BOPConfigurationIDs.timberID).setBiomeName("Timber"), BOPBiomeTemperatureType.COOL)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenTropicalRainforest(BOPConfigurationIDs.tropicalRainforestID).setBiomeName("Tropical Rainforest"), BOPBiomeTemperatureType.HOT)); - registerBiome(new BOPBiomeListEntry(new BiomeGenTropics(BOPConfigurationIDs.tropicsID).setBiomeName("Tropics"), BOPBiomeTemperatureType.HOT)); - registerBiome(new BOPBiomeListEntry(new BiomeGenTundra(BOPConfigurationIDs.tundraID).setBiomeName("Tundra"), BOPBiomeTemperatureType.ICY));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenTropicalRainforest(BOPConfigurationIDs.tropicalRainforestID).setBiomeName("Tropical Rainforest"), BOPBiomeTemperatureType.HOT)); + /*registerBiome(new BOPBiomeListEntry(new BiomeGenTropics(BOPConfigurationIDs.tropicsID).setBiomeName("Tropics"), BOPBiomeTemperatureType.HOT));*/ + registerOnlyBiome(new BOPBiomeListEntry(new BiomeGenTundra(BOPConfigurationIDs.tundraID).setBiomeName("Tundra"), BOPBiomeTemperatureType.ICY)); //registerBiome(new BOPBiomeListEntry(new BiomeGenVolcano(BOPConfigurationIDs.volcanoID).setBiomeName("Volcano"), BOPBiomeTemperatureType.HOT)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenWasteland(BOPConfigurationIDs.wastelandID).setBiomeName("Wasteland"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenWetland(BOPConfigurationIDs.wetlandID).setBiomeName("Wetland"), BOPBiomeTemperatureType.WARM)); diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index a10da422d..400d45164 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -10,6 +10,7 @@ public class BOPWorldFeatures public boolean generateGrass = false; public boolean generateSand = false; public boolean generateQuagmire = false; + public boolean generateMelons = false; public int waterPoolsPerChunk = 0; public int lavaPoolsPerChunk = 0; @@ -47,6 +48,7 @@ public class BOPWorldFeatures public int minersDelightPerChunk = 2; public int rootsPerChunk = 9; public int grassSplatterPerChunk = 0; + public int rockpilesPerChunk = 0; public int bopFlowersPerChunk = 0; } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenRainforestTree1.java b/src/main/java/biomesoplenty/common/world/features/WorldGenRainforestTree1.java new file mode 100644 index 000000000..462b1c597 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenRainforestTree1.java @@ -0,0 +1,179 @@ +package biomesoplenty.common.world.features; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.Direction; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenRainforestTree1 extends WorldGenAbstractTree +{ + private final int minTreeHeight; + private final int randomTreeHeight; + + private final Block wood; + private final Block leaves; + + private final int woodMeta; + private final int leavesMeta; + + public WorldGenRainforestTree1(Block wood, Block leaves, int woodMeta, int leavesMeta, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight) + { + super(doBlockNotify); + + this.wood = wood; + this.leaves = leaves; + this.woodMeta = woodMeta; + this.leavesMeta = leavesMeta; + this.minTreeHeight = minTreeHeight; + this.randomTreeHeight = randomTreeHeight; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int l = random.nextInt(randomTreeHeight) + this.minTreeHeight; + boolean flag = true; + + if (y >= 1 && y + l + 1 <= 256) + { + byte b0; + int k1; + Block block; + + for (int i1 = y; i1 <= y + 1 + l; ++i1) + { + b0 = 1; + + if (i1 == y) + { + b0 = 0; + } + + if (i1 >= y + 1 + l - 2) + { + b0 = 2; + } + + for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1) + { + for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) + { + if (i1 >= 0 && i1 < 256) + { + block = world.func_147439_a(j1, i1, k1); + + if (!this.isReplaceable(world, j1, i1, k1)) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block2 = world.func_147439_a(x, y - 1, z); + + boolean isSoil = block2.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (isSoil && y < 256 - l - 1) + { + block2.onPlantGrow(world, x, y - 1, z, x, y, z); + b0 = 3; + byte b1 = 0; + int l1; + int i2; + int j2; + int i3; + + for (k1 = y - b0 + l; k1 <= y + l; ++k1) + { + i3 = k1 - (y + l); + l1 = b1 + 1 - i3; + + for (i2 = x - l1; i2 <= x + l1; ++i2) + { + j2 = i2 - x; + + for (int k2 = z - l1; k2 <= z + l1; ++k2) + { + int l2 = k2 - z; + + if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0 && i3 != 0) + { + Block block1 = world.func_147439_a(i2, k1, k2); + + if (block1.isAir(world, i2, k1, k2) || block1.isLeaves(world, i2, k1, k2)) + { + this.func_150516_a(world, i2, k1, k2, Blocks.leaves, this.leavesMeta); + } + } + } + } + } + + for (k1 = 0; k1 < l; ++k1) + { + block = world.func_147439_a(x, y + k1, z); + + if (block.isAir(world, x, y + k1, z) || block.isLeaves(world, x, y + k1, z)) + { + //TODO: setBlock() + this.func_150516_a(world, x, y + k1, z, this.wood, this.woodMeta); + this.func_150516_a(world, x - 3, y + (l - 3), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x + 3, y + (l - 3), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x, y + (l - 3), z - 3, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x, y + (l - 3), z + 3, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x - 2, y + (l - 4), z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 2, y + (l - 4), z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + (l - 4), z - 2, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + (l - 4), z + 2, this.wood, this.woodMeta); + this.func_150516_a(world, x - 2, y + (l - 5), z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 2, y + (l - 5), z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + (l - 5), z - 2, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + (l - 5), z + 2, this.wood, this.woodMeta); + this.func_150516_a(world, x - 1, y + (l - 6), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x + 1, y + (l - 6), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x, y + (l - 6), z - 1, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x, y + (l - 6), z + 1, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x, y + (l - 3), z, this.leaves, this.leavesMeta); + this.func_150516_a(world, x, y + (l - 2), z, this.leaves, this.leavesMeta); + this.func_150516_a(world, x, y + (l - 1), z, this.leaves, this.leavesMeta); + this.func_150516_a(world, x, y + (l), z, this.leaves, this.leavesMeta); + this.func_150515_a(world, x, y + (l - 4), z, Blocks.air); + this.func_150515_a(world, x, y + (l - 5), z, Blocks.air); + this.func_150516_a(world, x - 1, y + (l - 3), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x + 1, y + (l - 3), z, this.wood, this.woodMeta + 4); + this.func_150516_a(world, x, y + (l - 3), z - 1, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x, y + (l - 3), z + 1, this.wood, this.woodMeta + 8); + this.func_150516_a(world, x, y + (l - 2), z, this.wood, this.woodMeta); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenRockpile.java b/src/main/java/biomesoplenty/common/world/features/WorldGenRockpile.java new file mode 100644 index 000000000..4234460c2 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenRockpile.java @@ -0,0 +1,98 @@ +package biomesoplenty.common.world.features; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenRockpile extends WorldGeneratorBOP +{ + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.func_147437_c(x, y, z) && y > 2) + { + --y; + } + + boolean isGrass = true; + + for (int ix = -1; ix <= 1; ix++) + { + for (int iz = -1; iz <= 1; iz++) + { + if (world.func_147439_a(x + ix, y, z + iz) != Blocks.grass) + { + isGrass = false; + break; + } + } + } + + if (!isGrass) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() + if (world.func_147437_c(x + var7, y - 1, z + var8) && world.func_147437_c(x + var7, y - 2, z + var8)) + return false; + } + } + + int var999 = random.nextInt(2); + + if (var999 == 0) + { + //TODO: setBlock() + this.func_150515_a(world, x, y, z, Blocks.dirt); + this.func_150515_a(world, x - 1, y, z, Blocks.dirt); + this.func_150515_a(world, x + 1, y, z, Blocks.dirt); + this.func_150515_a(world, x, y, z - 1, Blocks.dirt); + this.func_150515_a(world, x, y, z + 1, Blocks.dirt); + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + 1, z, Blocks.stone, 0); + this.func_150516_a(world, x + 1, y + 1, z, Blocks.stone, 0); + this.func_150516_a(world, x - 1, y + 1, z, Blocks.stone, 0); + this.func_150516_a(world, x, y + 1, z + 1, Blocks.stone, 0); + this.func_150516_a(world, x, y + 1, z - 1, Blocks.stone, 0); + this.func_150516_a(world, x, y + 2, z, Blocks.stone, 0); + return true; + } + else if (var999 == 1) + { + //TODO: setBlock() + this.func_150515_a(world, x, y, z, Blocks.dirt); + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + 1, z, Blocks.stone, 0); + return true; + } + + return true; + } + } + + @Override + public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception + { + for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++) + { + int randX = x + random.nextInt(16) + 8; + int randZ = z + random.nextInt(16) + 8; + int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + + worldGenerator.generate(world, random, randX, randY, randZ); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/forcedworldgenerators/MelonForcedGenerator.java b/src/main/java/biomesoplenty/common/world/forcedworldgenerators/MelonForcedGenerator.java new file mode 100644 index 000000000..a3bbc74e5 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/forcedworldgenerators/MelonForcedGenerator.java @@ -0,0 +1,26 @@ +package biomesoplenty.common.world.forcedworldgenerators; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.ForcedWorldGeneratorBOP; + +public class MelonForcedGenerator extends ForcedWorldGeneratorBOP +{ + @Override + public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception + { + if (bopDecoration.getWorldFeatures().generateMelons) + { + int randX = x + random.nextInt(16) + 8; + int randZ = z + random.nextInt(16) + 8; + int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + + worldGenerator.generate(world, random, randX, randY, randZ); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java b/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java index 8aa3c48b3..792bc1f0d 100644 --- a/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java +++ b/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java @@ -4,7 +4,9 @@ import java.util.HashMap; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; +import net.minecraft.world.gen.feature.WorldGenMelon; import biomesoplenty.common.world.forcedworldgenerators.LakesForcedGenerator; +import biomesoplenty.common.world.forcedworldgenerators.MelonForcedGenerator; import biomesoplenty.common.world.forcedworldgenerators.PondForcedGenerator; public class ForcedBOPWorldGenerators @@ -20,6 +22,7 @@ public class ForcedBOPWorldGenerators { addForcedGenerator(WorldGenLiquids.class, new PondForcedGenerator()); addForcedGenerator(WorldGenLakes.class, new LakesForcedGenerator()); + addForcedGenerator(WorldGenMelon.class, new MelonForcedGenerator()); } public static void addForcedGenerator(Class worldGenClass, ForcedWorldGeneratorBOP generator) diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 720d4a4a5..c28bacd59 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -5,6 +5,7 @@ import java.util.HashMap; import net.minecraft.init.Blocks; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; +import net.minecraft.world.gen.feature.WorldGenMelon; import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; @@ -12,6 +13,7 @@ import biomesoplenty.common.world.features.WorldGenBOPFlora; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.WorldGenGrassSplatter; import biomesoplenty.common.world.features.WorldGenRiverCane; +import biomesoplenty.common.world.features.WorldGenRockpile; import biomesoplenty.common.world.features.WorldGenSplotches; import biomesoplenty.common.world.features.WorldGenWaterReeds; import biomesoplenty.common.world.features.WorldGenWaterside; @@ -34,6 +36,7 @@ public class WorldGenFieldAssociation associateField("generateGrass", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("redRock"))); associateField("generateSand", new WorldGenSplotches(Blocks.sand, 0, 32, BOPBlockHelper.get("redRock"))); associateField("generateQuagmire", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("mud"))); + associateField("generateMelons", new WorldGenMelon()); associateField("waterPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_water)); associateField("lavaPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_lava)); @@ -69,6 +72,7 @@ public class WorldGenFieldAssociation associateField("minersDelightPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("flowers2"), 6)); associateField("rootsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("plants"), 15)); associateField("grassSplatterPerChunk", new WorldGenGrassSplatter()); + associateField("rockpilesPerChunk", new WorldGenRockpile()); associateField("doubleTallGrassPerChunk", new WorldGenBOPDoubleFlora(Blocks.double_plant, Blocks.double_plant, 2, 8)); associateField("sunflowersPerChunk", new WorldGenBOPDoubleFlora(Blocks.double_plant, Blocks.double_plant, 0, 8));