From 0aa572cdea21233863618474f366b4065b464135 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Thu, 8 Aug 2013 18:54:45 -0400 Subject: [PATCH] Added Silkglades biome --- src/minecraft/biomesoplenty/api/Biomes.java | 1 + .../biomes/BiomeDecoratorBOP.java | 13 ++ .../biomes/BiomeGenOminousWoods.java | 1 - .../biomes/BiomeGenSilkglades.java | 128 +++++++++++++ .../configuration/BOPBiomes.java | 11 ++ .../configuration/BOPConfiguration.java | 4 + .../integration/ForestryIntegration.java | 2 + .../integration/MFRIntegration.java | 3 - .../biomesoplenty/world/ChunkProviderBOP.java | 2 +- .../biomesoplenty/world/WorldTypeBOP.java | 4 + .../worldgen/WorldGenBirchWillow.java | 179 ++++++++++++++++++ .../worldgen/WorldGenCobwebNest.java | 62 ++++++ .../worldgen/WorldGenCobwebs.java | 40 ++++ 13 files changed, 445 insertions(+), 5 deletions(-) create mode 100644 src/minecraft/biomesoplenty/biomes/BiomeGenSilkglades.java create mode 100644 src/minecraft/biomesoplenty/worldgen/WorldGenBirchWillow.java create mode 100644 src/minecraft/biomesoplenty/worldgen/WorldGenCobwebNest.java create mode 100644 src/minecraft/biomesoplenty/worldgen/WorldGenCobwebs.java diff --git a/src/minecraft/biomesoplenty/api/Biomes.java b/src/minecraft/biomesoplenty/api/Biomes.java index afc763081..db51a551a 100644 --- a/src/minecraft/biomesoplenty/api/Biomes.java +++ b/src/minecraft/biomesoplenty/api/Biomes.java @@ -101,6 +101,7 @@ public class Biomes public static Optional shore = Optional.absent(); public static Optional shrubland = Optional.absent(); public static Optional shrublandForest = Optional.absent(); + public static Optional silkglades = Optional.absent(); public static Optional sludgepit = Optional.absent(); public static Optional spruceWoods = Optional.absent(); public static Optional steppe = Optional.absent(); diff --git a/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java b/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java index 6391e0966..747db2bc5 100644 --- a/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java +++ b/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java @@ -59,6 +59,7 @@ import biomesoplenty.worldgen.WorldGenCanyon; import biomesoplenty.worldgen.WorldGenCanyonGrass; import biomesoplenty.worldgen.WorldGenCattail; import biomesoplenty.worldgen.WorldGenCloud; +import biomesoplenty.worldgen.WorldGenCobwebs; import biomesoplenty.worldgen.WorldGenCrystal1; import biomesoplenty.worldgen.WorldGenCrystal2; import biomesoplenty.worldgen.WorldGenDesertCactus; @@ -177,6 +178,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator protected WorldGenerator netherGrassGen; protected WorldGenerator netherWartGen; protected WorldGenerator steppeGen; + protected WorldGenerator cobwebGen; protected WorldGenerator thornGen; protected WorldGenerator toadstoolGen; protected WorldGenerator portobelloGen; @@ -281,6 +283,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator protected int poisonIvyPerChunk; protected int sunflowersPerChunk; protected int rainbowflowersPerChunk; + protected int cobwebsPerChunk; protected int boneSpinesPerChunk; protected int boneSpines2PerChunk; @@ -408,6 +411,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator diamondGen = new WorldGenMinable(Block.oreDiamond.blockID, 7); lapisGen = new WorldGenMinable(Block.oreLapis.blockID, 6); plantYellowGen = new WorldGenBOPFlowers(Block.plantYellow.blockID, 0); + cobwebGen = new WorldGenCobwebs(Block.web.blockID, 0); dandelionGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 15); plantRedGen = new WorldGenBOPFlowers(Block.plantRed.blockID, 0); plantWhiteGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 9); @@ -540,6 +544,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator crystals2PerChunk = 0; boneSpinesPerChunk = 0; boneSpines2PerChunk = 0; + cobwebsPerChunk = 0; generateLakes = true; generateAsh = false; generateMycelium = false; @@ -897,6 +902,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator var5 = chunk_Z + randomGenerator.nextInt(16) + 8; plantRedGen.generate(currentWorld, randomGenerator, var3, var4, var5); } + + for (var2 = 0; var2 < cobwebsPerChunk; ++var2) + { + var3 = chunk_X + randomGenerator.nextInt(16) + 8; + var4 = randomGenerator.nextInt(256); + var5 = chunk_Z + randomGenerator.nextInt(16) + 8; + cobwebGen.generate(currentWorld, randomGenerator, var3, var4, var5); + } for (var2 = 0; var2 < sunflowersPerChunk; ++var2) { diff --git a/src/minecraft/biomesoplenty/biomes/BiomeGenOminousWoods.java b/src/minecraft/biomesoplenty/biomes/BiomeGenOminousWoods.java index c0ac56693..62dd42ae5 100644 --- a/src/minecraft/biomesoplenty/biomes/BiomeGenOminousWoods.java +++ b/src/minecraft/biomesoplenty/biomes/BiomeGenOminousWoods.java @@ -42,7 +42,6 @@ public class BiomeGenOminousWoods extends BiomeGenBase spawnableCreatureList.clear(); spawnableWaterCreatureList.clear(); spawnableMonsterList.add(new SpawnListEntry(EntityCaveSpider.class, 5, 1, 2)); - spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 7, 1, 2)); spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 10, 1, 4)); spawnableCaveCreatureList.add(new SpawnListEntry(EntityBat.class, 10, 8, 8)); } diff --git a/src/minecraft/biomesoplenty/biomes/BiomeGenSilkglades.java b/src/minecraft/biomesoplenty/biomes/BiomeGenSilkglades.java new file mode 100644 index 000000000..718691f18 --- /dev/null +++ b/src/minecraft/biomesoplenty/biomes/BiomeGenSilkglades.java @@ -0,0 +1,128 @@ +package biomesoplenty.biomes; + +import java.awt.Color; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.SpawnListEntry; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.Blocks; +import biomesoplenty.configuration.BOPConfiguration; +import biomesoplenty.worldgen.WorldGenBirchWillow; +import biomesoplenty.worldgen.WorldGenCobwebNest; +import biomesoplenty.worldgen.WorldGenDeadTree; +import biomesoplenty.worldgen.WorldGenWillow; + +public class BiomeGenSilkglades extends BiomeGenBase +{ + private BiomeDecoratorBOP customBiomeDecorator; + + public BiomeGenSilkglades(int par1) + { + super(par1); + theBiomeDecorator = new BiomeDecoratorBOP(this); + customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; + customBiomeDecorator.treesPerChunk = 6; + customBiomeDecorator.grassPerChunk = 3; + customBiomeDecorator.flowersPerChunk = -999; + customBiomeDecorator.reedsPerChunk = -999; + customBiomeDecorator.sandPerChunk = -999; + customBiomeDecorator.sandPerChunk2 = -999; + customBiomeDecorator.gravelPerChunk = 3; + customBiomeDecorator.gravelPerChunk2 = 3; + customBiomeDecorator.sproutsPerChunk = 2; + customBiomeDecorator.poisonIvyPerChunk = 2; + customBiomeDecorator.cobwebsPerChunk = 9; + customBiomeDecorator.generatePumpkins = true; + waterColorMultiplier = 16777079; + spawnableWaterCreatureList.clear(); + spawnableCreatureList.clear(); + spawnableCreatureList.add(new SpawnListEntry(EntitySpider.class, 7, 1, 2)); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + @Override + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return par1Random.nextInt(3) == 0 ? new WorldGenBirchWillow() : (par1Random.nextInt(6) == 0 ? new WorldGenDeadTree(false) : (par1Random.nextInt(12) == 0 ? new WorldGenCobwebNest(0,0) : new WorldGenWillow())); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + @Override + public WorldGenerator getRandomWorldGenForGrass(Random par1Random) + { + return new WorldGenTallGrass(Block.tallGrass.blockID, 0); + } + + @Override + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + super.decorate(par1World, par2Random, par3, par4); + int var5 = 12 + par2Random.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); + + if (var10 == Block.stone.blockID) + { + par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 10, 2); + } + } + } + + /** + * Provides the basic grass color based on the biome temperature and rainfall + */ + @Override + public int getBiomeGrassColor() + { + return 13420973; + } + + /** + * Provides the basic foliage color based on the biome temperature and rainfall + */ + @Override + public int getBiomeFoliageColor() + { + return 14146486; + } + + /** + * takes temperature, returns color + */ + @Override + public int getSkyColorByTemp(float par1) + { + if (BOPConfiguration.Misc.skyColors) + return 13553096; + 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(); + } + } +} diff --git a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java index 32e8ab165..3686c7f97 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java @@ -158,6 +158,7 @@ public class BOPBiomes { Biomes.shore = Optional.of((new BiomeGenShore(BOPConfiguration.IDs.shoreID)).setColor(9286496).setBiomeName("Shore").setMinMaxHeight(-1.0F, 0.4F).setTemperatureRainfall(0.8F, 0.4F)); Biomes.shrubland = Optional.of((new BiomeGenShrubland(BOPConfiguration.IDs.shrublandID)).setColor(9286496).setBiomeName("Shrubland").setMinMaxHeight(0.3F, 0.4F).setTemperatureRainfall(0.6F, 0.0F)); Biomes.shrublandForest = Optional.of((new BiomeGenShrublandForest(BOPConfiguration.IDs.shrublandForestID)).setColor(9286496).setBiomeName("Thick Shrubland").setMinMaxHeight(0.3F, 0.4F).setTemperatureRainfall(0.6F, 0.0F)); + Biomes.silkglades = Optional.of((new BiomeGenSilkglades(BOPConfiguration.IDs.silkgladesID)).setColor(522674).setBiomeName("Silkglades").func_76733_a(9154376).setMinMaxHeight(0.3F, 0.3F).setTemperatureRainfall(0.5F, 0.9F)); Biomes.sludgepit = Optional.of((new BiomeGenSludgepit(BOPConfiguration.IDs.sludgepitID)).setColor(522674).setBiomeName("Sludgepit").func_76733_a(9154376).setMinMaxHeight(0.1F, 0.3F).setTemperatureRainfall(0.8F, 0.9F)); Biomes.spruceWoods = Optional.of((new BiomeGenSpruceWoods(BOPConfiguration.IDs.spruceWoodsID)).setColor(353825).setBiomeName("Spruce Woods").func_76733_a(5159473).setTemperatureRainfall(0.6F, 0.7F)); Biomes.steppe = Optional.of((new BiomeGenSteppe(BOPConfiguration.IDs.steppeID)).setColor(9286496).setBiomeName("Steppe").setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.3F, 0.4F)); @@ -287,6 +288,7 @@ public class BOPBiomes { BiomeDictionary.registerBiomeType(Biomes.shrubland.get(), Type.PLAINS); BiomeDictionary.registerBiomeType(Biomes.shrublandForest.get(), Type.PLAINS); + BiomeDictionary.registerBiomeType(Biomes.silkglades.get(), Type.SWAMP, Type.WASTELAND); BiomeDictionary.registerBiomeType(Biomes.sludgepit.get(), Type.SWAMP, Type.WASTELAND); BiomeDictionary.registerBiomeType(Biomes.spruceWoods.get(), Type.FOREST); BiomeDictionary.registerBiomeType(Biomes.steppe.get(), Type.PLAINS, Type.WASTELAND); @@ -523,6 +525,7 @@ public class BOPBiomes { addStrongholdBiome(Biomes.seasonalForest); addStrongholdBiome(Biomes.shield); addStrongholdBiome(Biomes.shrubland); + addStrongholdBiome(Biomes.silkglades); addStrongholdBiome(Biomes.sludgepit); addStrongholdBiome(Biomes.spruceWoods); addStrongholdBiome(Biomes.steppe); @@ -796,6 +799,10 @@ public class BOPBiomes { if (BOPConfiguration.BiomeGen.shrublandGen) { registerBiome(Biomes.shrubland); } + + if (BOPConfiguration.BiomeGen.silkgladesGen) { + registerBiome(Biomes.silkglades); + } if (BOPConfiguration.BiomeGen.sludgepitGen) { registerBiome(Biomes.sludgepit); @@ -1174,6 +1181,10 @@ public class BOPBiomes { if (BOPConfiguration.BiomeGen.shrublandGen) { addBiomeToWorldTypes(getWorldTypes(), Biomes.shrubland); } + + if (BOPConfiguration.BiomeGen.silkgladesGen) { + addBiomeToWorldTypes(getWorldTypes(), Biomes.silkglades); + } if (BOPConfiguration.BiomeGen.sludgepitGen) { addBiomeToWorldTypes(getWorldTypes(), Biomes.sludgepit); diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index d4c1566a3..326d697f0 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -137,6 +137,7 @@ public class BOPConfiguration public static boolean seasonalForestGen; public static boolean shieldGen; public static boolean shrublandGen; + public static boolean silkgladesGen; public static boolean sludgepitGen; public static boolean spruceWoodsGen; public static boolean steppeGen; @@ -243,6 +244,7 @@ public class BOPConfiguration seasonalForestGen = config.get("Biomes To Generate", "SeasonalForest", true).getBoolean(false); shieldGen = config.get("Biomes To Generate", "Shield", true).getBoolean(false); shrublandGen = config.get("Biomes To Generate", "Shrubland", true).getBoolean(false); + silkgladesGen = config.get("Biomes To Generate", "Silkglades", false).getBoolean(false); sludgepitGen = config.get("Biomes To Generate", "Sludgepit", true).getBoolean(false); spruceWoodsGen = config.get("Biomes To Generate", "SpruceWoods", true).getBoolean(false); steppeGen = config.get("Biomes To Generate", "Steppe", true).getBoolean(false); @@ -747,6 +749,7 @@ public class BOPConfiguration public static int shoreID; public static int shrublandID; public static int shrublandForestID; + public static int silkgladesID; public static int sludgepitID; public static int spruceWoodsID; public static int steppeID; @@ -956,6 +959,7 @@ public class BOPConfiguration //23-79 ExtraBiomesXL + silkgladesID = config.get("Biome IDs", "Silkglades ID", 38).getInt(); savannaPlateauID = config.get("Biome IDs", "Savanna Plateau (Sub-Biome) ID", 39).getInt(); fieldForestID = config.get("Biome IDs", "Forested Field (Sub-Biome) ID", 40).getInt(); seasonalSpruceForestID = config.get("Biome IDs", "Seasonal Spruce Forest (Sub-Biome) ID", 41).getInt(); diff --git a/src/minecraft/biomesoplenty/integration/ForestryIntegration.java b/src/minecraft/biomesoplenty/integration/ForestryIntegration.java index 8f099ffeb..0ce58fc13 100644 --- a/src/minecraft/biomesoplenty/integration/ForestryIntegration.java +++ b/src/minecraft/biomesoplenty/integration/ForestryIntegration.java @@ -118,6 +118,7 @@ public class ForestryIntegration EnumTemperature.normalBiomeIds.add(BOPConfiguration.IDs.wetlandID); EnumTemperature.normalBiomeIds.add(BOPConfiguration.IDs.fenID); EnumTemperature.normalBiomeIds.add(BOPConfiguration.IDs.swamplandNewID); + EnumTemperature.normalBiomeIds.add(BOPConfiguration.IDs.silkgladesID); EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.bayouID); EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.bogID); @@ -134,6 +135,7 @@ public class ForestryIntegration EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.wetlandID); EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.fenID); EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.swamplandNewID); + EnumHumidity.dampBiomeIds.add(BOPConfiguration.IDs.silkgladesID); //Normal //Forest and Meadows Hives diff --git a/src/minecraft/biomesoplenty/integration/MFRIntegration.java b/src/minecraft/biomesoplenty/integration/MFRIntegration.java index 63165cb86..5e90fc985 100644 --- a/src/minecraft/biomesoplenty/integration/MFRIntegration.java +++ b/src/minecraft/biomesoplenty/integration/MFRIntegration.java @@ -38,12 +38,9 @@ public class MFRIntegration FarmingRegistry.registerRubberTreeBiome(Biomes.deciduousForest.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.forestNew.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.grove.get().biomeName); - FarmingRegistry.registerRubberTreeBiome(Biomes.highland.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.jungleNew.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.lushSwamp.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.mapleWoods.get().biomeName); - FarmingRegistry.registerRubberTreeBiome(Biomes.marsh.get().biomeName); - FarmingRegistry.registerRubberTreeBiome(Biomes.moor.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.rainforest.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.seasonalForest.get().biomeName); FarmingRegistry.registerRubberTreeBiome(Biomes.shield.get().biomeName); diff --git a/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java b/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java index 171b1a95f..6281e1638 100644 --- a/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java +++ b/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java @@ -578,7 +578,7 @@ public class ChunkProviderBOP implements IChunkProvider int l1; int i2; - if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && biomegenbase != Biomes.desertNew.get() && biomegenbase != Biomes.glacier.get() && biomegenbase != Biomes.volcano.get() && biomegenbase != Biomes.scrubland.get() && biomegenbase != Biomes.dunes.get() && biomegenbase != Biomes.arctic.get() && biomegenbase != Biomes.pasture.get() && !flag && this.rand.nextInt(4) == 0 + if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && biomegenbase != Biomes.desertNew.get() && biomegenbase != Biomes.glacier.get() && biomegenbase != Biomes.volcano.get() && biomegenbase != Biomes.scrubland.get() && biomegenbase != Biomes.dunes.get() && biomegenbase != Biomes.arctic.get() && biomegenbase != Biomes.pasture.get() && biomegenbase != Biomes.silkglades.get() && !flag && this.rand.nextInt(4) == 0 && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) { k1 = k + this.rand.nextInt(16) + 8; diff --git a/src/minecraft/biomesoplenty/world/WorldTypeBOP.java b/src/minecraft/biomesoplenty/world/WorldTypeBOP.java index 237ef28d6..547c02d69 100644 --- a/src/minecraft/biomesoplenty/world/WorldTypeBOP.java +++ b/src/minecraft/biomesoplenty/world/WorldTypeBOP.java @@ -261,6 +261,10 @@ public class WorldTypeBOP extends WorldType { addNewBiome(Biomes.shrubland); } + if (BOPConfiguration.BiomeGen.silkgladesGen == true) + { + addNewBiome(Biomes.silkglades); + } if (BOPConfiguration.BiomeGen.sludgepitGen == true) { addNewBiome(Biomes.sludgepit); diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenBirchWillow.java b/src/minecraft/biomesoplenty/worldgen/WorldGenBirchWillow.java new file mode 100644 index 000000000..1581b1a9f --- /dev/null +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenBirchWillow.java @@ -0,0 +1,179 @@ +package biomesoplenty.worldgen; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.Blocks; + +public class WorldGenBirchWillow extends WorldGenerator +{ + @Override + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + int var6; + + for (var6 = par2Random.nextInt(8) + 6; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4) + { + ; + } + + boolean var7 = true; + + if (par4 >= 1 && par4 + var6 + 1 <= 128) + { + int var8; + int var10; + int var11; + int var12; + + for (var8 = par4; var8 <= par4 + 1 + var6; ++var8) + { + byte var9 = 1; + + if (var8 == par4) + { + var9 = 0; + } + + if (var8 >= par4 + 1 + var6 - 2) + { + var9 = 3; + } + + for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10) + { + for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11) + { + if (var8 >= 0 && var8 < 128) + { + var12 = par1World.getBlockId(var10, var8, var11); + + if (var12 != 0 && var12 != Blocks.leaves1.get().blockID) + { + if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID) + { + var7 = false; + } + else if (var8 > par4) + { + var7 = false; + } + } + } + else + { + var7 = false; + } + } + } + } + + if (!var7) + return false; + else + { + var8 = par1World.getBlockId(par3, par4 - 1, par5); + + if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 128 - var6 - 1) + { + this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); + int var13; + int var16; + + for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) + { + var10 = var16 - (par4 + var6); + var11 = 2 - var10 / 2; + + for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) + { + var13 = var12 - par3; + + for (int var14 = par5 - var11; var14 <= par5 + var11; ++var14) + { + int var15 = var14 - par5; + + if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)]) + { + this.setBlockAndMetadata(par1World, var12, var16, var14, Blocks.leaves1.get().blockID, 4); + } + } + } + } + + for (var16 = 0; var16 < var6; ++var16) + { + var10 = par1World.getBlockId(par3, par4 + var16, par5); + + if (var10 == 0 || var10 == Blocks.leaves1.get().blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID) + { + this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 0); + } + } + + for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) + { + var10 = var16 - (par4 + var6); + var11 = 2 - var10 / 2; + + for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) + { + for (var13 = par5 - var11; var13 <= par5 + var11; ++var13) + { + if (par1World.getBlockId(var12, var16, var13) == Blocks.leaves1.get().blockID) + { + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) + { + this.generateVines(par1World, var12 - 1, var16, var13, 8); + } + + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 + 1, var16, var13) == 0) + { + this.generateVines(par1World, var12 + 1, var16, var13, 2); + } + + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 - 1) == 0) + { + this.generateVines(par1World, var12, var16, var13 - 1, 1); + } + + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 + 1) == 0) + { + this.generateVines(par1World, var12, var16, var13 + 1, 4); + } + } + } + } + } + + return true; + } else + return false; + } + } else + return false; + } + + /** + * Generates vines at the given position until it hits a block. + */ + private void generateVines(World par1World, int par2, int par3, int par4, int par5) + { + this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.leaves1.get().blockID, 4); + int var6 = 4; + + while (true) + { + --par3; + + if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0) + return; + + this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.leaves1.get().blockID, 4); + --var6; + } + } +} diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebNest.java b/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebNest.java new file mode 100644 index 000000000..2e7cfd64d --- /dev/null +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebNest.java @@ -0,0 +1,62 @@ +package biomesoplenty.worldgen; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.Blocks; + +public class WorldGenCobwebNest extends WorldGenerator +{ + private int field_76527_a; + private int field_76526_b; + + public WorldGenCobwebNest(int par1, int par2) + { + field_76526_b = par1; + field_76527_a = par2; + } + + @Override + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + int var15; + + for (boolean var6 = false; ((var15 = par1World.getBlockId(par3, par4, par5)) == 0 || var15 == Block.web.blockID) && par4 > 0; --par4) + { + ; + } + + int var7 = par1World.getBlockId(par3, par4, par5); + + if (var7 == Block.grass.blockID) + { + ++par4; + this.setBlockAndMetadata(par1World, par3, par4, par5, Block.web.blockID, 0); + + for (int var8 = par4; var8 <= par4 + 1; ++var8) + { + int var9 = var8 - par4; + int var10 = 2 - var9; + + for (int var11 = par3 - var10; var11 <= par3 + var10; ++var11) + { + int var12 = var11 - par3; + + for (int var13 = par5 - var10; var13 <= par5 + var10; ++var13) + { + int var14 = var13 - par5; + + if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)]) + { + this.setBlockAndMetadata(par1World, var11, var8, var13, Block.web.blockID, 0); + } + } + } + } + } + + return true; + } +} diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebs.java b/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebs.java new file mode 100644 index 000000000..a4c7028c5 --- /dev/null +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenCobwebs.java @@ -0,0 +1,40 @@ +package biomesoplenty.worldgen; + +import java.util.Random; + +import biomesoplenty.api.Blocks; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class WorldGenCobwebs extends WorldGenerator +{ + /** The ID of the plant block used in this plant generator. */ + private int plantBlockId; + private int plantBlockMeta; + + public WorldGenCobwebs(int par1, int meta) + { + plantBlockId = par1; + plantBlockMeta = meta; + } + + @Override + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + for (int l = 0; l < 64; ++l) + { + int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); + int j1 = par4 + par2Random.nextInt(8) - par2Random.nextInt(8); + int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); + + if (par1World.isAirBlock(i1, j1, k1) && (par1World.getBlockId(i1, j1 + 1, k1) == Blocks.leaves1.get().blockID || par1World.getBlockId(i1, j1 + 1, k1) == Blocks.leavesColorized.get().blockID || par1World.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID)) + { + par1World.setBlock(i1, j1, k1, Block.web.blockID, 0, 2); + } + } + + return true; + } +}