diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java index 289b28bd3..7feb3d05c 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java @@ -10,7 +10,7 @@ import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.trees.WorldGenBrush1; import biomesoplenty.common.world.features.trees.WorldGenBrush2; -import biomesoplenty.common.world.features.trees.WorldGenChaparral2; +import biomesoplenty.common.world.features.trees.WorldGenMiniShrub; public class BiomeGenBrushland extends BOPBiome { @@ -40,7 +40,7 @@ public class BiomeGenBrushland extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(2) == 0 ? new WorldGenBrush2() : (random.nextInt(5) == 0 ? new WorldGenBrush1() : new WorldGenChaparral2()); + return random.nextInt(2) == 0 ? new WorldGenBrush2(Blocks.log, Blocks.leaves, 3, 0, Blocks.grass) : (random.nextInt(5) == 0 ? new WorldGenBrush1() : new WorldGenMiniShrub(Blocks.log, Blocks.leaves, 0, 0, Blocks.grass, Blocks.sand)); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenChaparral.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenChaparral.java index 077f77adf..973612983 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenChaparral.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenChaparral.java @@ -13,7 +13,7 @@ import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.trees.WorldGenBOPShrub; -import biomesoplenty.common.world.features.trees.WorldGenChaparral2; +import biomesoplenty.common.world.features.trees.WorldGenMiniShrub; import biomesoplenty.common.world.features.trees.WorldGenChaparral3; public class BiomeGenChaparral extends BOPBiome @@ -50,7 +50,7 @@ public class BiomeGenChaparral extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(2) == 0 ? new WorldGenChaparral2() : (random.nextInt(5) == 0 ? new WorldGenBOPShrub(Blocks.log, Blocks.leaves, 0, 0, Blocks.grass, Blocks.sand) : new WorldGenChaparral3()); + return random.nextInt(2) == 0 ? new WorldGenMiniShrub(Blocks.log, Blocks.leaves, 0, 0, Blocks.grass, Blocks.sand) : (random.nextInt(5) == 0 ? new WorldGenBOPShrub(Blocks.log, Blocks.leaves, 0, 0, Blocks.grass, Blocks.sand) : new WorldGenChaparral3()); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenGrove.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenGrove.java index fc99d074c..f71ba2ec8 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenGrove.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenGrove.java @@ -12,7 +12,7 @@ import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPFlora; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.trees.WorldGenChaparral2; +import biomesoplenty.common.world.features.trees.WorldGenMiniShrub; import biomesoplenty.common.world.features.trees.WorldGenPoplar; import biomesoplenty.common.world.features.trees.WorldGenPoplar2; @@ -46,7 +46,7 @@ public class BiomeGenGrove extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(2) == 0 ? new WorldGenChaparral2() : random.nextInt(3) == 0 ? new WorldGenPoplar2() : new WorldGenPoplar(); + return random.nextInt(2) == 0 ? new WorldGenMiniShrub(Blocks.log, Blocks.leaves, 0, 0, Blocks.grass, Blocks.sand) : random.nextInt(3) == 0 ? new WorldGenPoplar2() : new WorldGenPoplar(); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenOutback.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenOutback.java index 26f461168..78a999338 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenOutback.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenOutback.java @@ -1,61 +1,72 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.trees.WorldGenBOPShrub; +import biomesoplenty.common.world.features.trees.WorldGenMiniShrub; public class BiomeGenOutback extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.4F); - public BiomeGenOutback(int par1) + public BiomeGenOutback(int id) { - super(par1); - /* - spawnableCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - topBlock = (byte)Blocks.hardSand.get().blockID; - fillerBlock = (byte)Blocks.hardSand.get().blockID; - customBiomeDecorator.treesPerChunk = 3; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.outbackPerChunk = 10; - customBiomeDecorator.deadBushPerChunk = 7; - customBiomeDecorator.tinyCactiPerChunk = 2; - customBiomeDecorator.cactiPerChunk = 4; - customBiomeDecorator.bushesPerChunk = 5; - customBiomeDecorator.generatePumpkins = false; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(10843716); + this.setTemperatureRainfall(0.8F, 0.05F); + + this.spawnableCreatureList.clear(); + + this.topBlock = BOPBlockHelper.get("hardSand"); + this.fillerBlock = BOPBlockHelper.get("hardSand"); + this.theBiomeDecorator.treesPerChunk = 3; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 7; + this.theBiomeDecorator.cactiPerChunk = 4; + + this.bopWorldFeatures.grassSplatterPerChunk = 10; + this.bopWorldFeatures.tinyCactiPerChunk = 2; + this.bopWorldFeatures.bushesPerChunk = 5; + this.bopWorldFeatures.generatePumpkins = false; } - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(3) == 0 ? new WorldGenBOPShrub(Blocks.log2, Blocks.leaves2, 0, 0, BOPBlockHelper.get("hardSand")) : + new WorldGenMiniShrub(Blocks.log2, Blocks.leaves2, 0, 0, BOPBlockHelper.get("hardSand")); + } + + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + 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); + 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); - 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, 2, 2); - } - } - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(3) == 0 ? new WorldGenOutbackShrub(0,0) : new WorldGenOutbackTree(); - } - */ + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 2, 2); + } + } + } } diff --git a/src/main/java/biomesoplenty/common/blocks/BlockBOPPlant.java b/src/main/java/biomesoplenty/common/blocks/BlockBOPPlant.java index 76ccfb422..ffee826c6 100644 --- a/src/main/java/biomesoplenty/common/blocks/BlockBOPPlant.java +++ b/src/main/java/biomesoplenty/common/blocks/BlockBOPPlant.java @@ -177,8 +177,8 @@ public class BlockBOPPlant extends BOPBlockWorldDecor implements IShearable case 14: // Reed return block == Blocks.water; - case 15: // Reed - return root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass") || root == BOPBlockHelper.get("holyGrass") || root == BOPBlockHelper.get("holyDirt"); + case 15: // Root + return root != Blocks.air && (root == Blocks.grass || root == Blocks.dirt || root == Blocks.farmland || root == BOPBlockHelper.get("longGrass") || root == BOPBlockHelper.get("holyGrass") || root == BOPBlockHelper.get("holyDirt")); default: return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block == BOPBlockHelper.get("overgrownNetherrack"); diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index b61849c76..20deb5282 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -40,6 +40,7 @@ import biomesoplenty.common.biomes.BiomeGenMountain; import biomesoplenty.common.biomes.BiomeGenMysticGrove; import biomesoplenty.common.biomes.BiomeGenOminousWoods; import biomesoplenty.common.biomes.BiomeGenOriginValley; +import biomesoplenty.common.biomes.BiomeGenOutback; import biomesoplenty.common.biomes.BiomeGenPasture; import biomesoplenty.common.biomes.BiomeGenRainforest; import biomesoplenty.common.biomes.BiomeGenSacredSprings; @@ -123,7 +124,7 @@ public class BOPBiomes registerBiome(new BOPBiomeListEntry(new BiomeGenMysticGrove(BOPConfigurationIDs.mysticGroveID).setBiomeName("Mystic Grove"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenOminousWoods(BOPConfigurationIDs.ominousWoodsID).setBiomeName("Ominous Woods"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenOriginValley(BOPConfigurationIDs.originValleyID).setBiomeName("Origin Valley"), BOPBiomeTemperatureType.WARM)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenOutback(BOPConfigurationIDs.outbackID).setBiomeName("Outback"), BOPBiomeTemperatureType.HOT));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenOutback(BOPConfigurationIDs.outbackID).setBiomeName("Outback"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenPasture(BOPConfigurationIDs.pastureID).setBiomeName("Pasture"), BOPBiomeTemperatureType.WARM)); //registerBiome(new BOPBiomeListEntry(new BiomeGenPrairie(BOPConfigurationIDs.prairieID).setBiomeName("Prairie"), BOPBiomeTemperatureType.WARM)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenQuagmire(BOPConfigurationIDs.quagmireID).setBiomeName("Quagmire"), 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 4ce1f48e5..8b57a5054 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -44,6 +44,7 @@ public class BOPWorldFeatures public int sunflowersPerChunk = 0; public int minersDelightPerChunk = 2; public int rootsPerChunk = 9; + public int grassSplatterPerChunk = 0; public int bopFlowersPerChunk = 0; } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenGrassSplatter.java b/src/main/java/biomesoplenty/common/world/features/WorldGenGrassSplatter.java new file mode 100644 index 000000000..c04d94b8a --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenGrassSplatter.java @@ -0,0 +1,79 @@ +package biomesoplenty.common.world.features; + +import java.lang.reflect.Field; +import java.util.Random; + +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.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenGrassSplatter extends WorldGeneratorBOP +{ + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + Block block; + + do + { + block = world.func_147439_a(x, y, z); + if (!(block.isLeaves(world, x, y, z) || block.isAir(world, x, y, z))) + { + break; + } + --y; + } while (y > 0); + + for (int var7 = 0; var7 < 128; ++var7) + { + int randX = x + random.nextInt(8) - random.nextInt(8); + int randY = y + random.nextInt(4) - random.nextInt(4); + int randZ = z + random.nextInt(8) - random.nextInt(8); + + int var999 = random.nextInt(5); + + //TODO: isAirBlock() + if (world.func_147437_c(randX, randY, randZ) && (world.func_147439_a(randX, randY - 1, randZ) == BOPBlockHelper.get("hardSand") || world.func_147439_a(randX, randY - 1, randZ) == Blocks.sand || world.func_147439_a(randX, randY - 1, randZ) == Blocks.stone)) + { + world.func_147465_d(randX, randY - 1, randZ, Blocks.grass, 0, 2); + + if (var999 == 0) + { + world.func_147465_d(randX, randY, randZ, BOPBlockHelper.get("foliage"), 2, 2); + } + else if (var999 == 1) + { + world.func_147465_d(randX, randY, randZ, BOPBlockHelper.get("foliage"), 10, 2); + } + else if (var999 == 2) + { + world.func_147465_d(randX, randY, randZ, BOPBlockHelper.get("foliage"), 11, 2); + } + else + { + world.func_147465_d(randX, randY, randZ, BOPBlockHelper.get("foliage"), 2, 2); + } + } + } + + 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/features/trees/WorldGenBrush2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java index 29ef4b675..db2a53c4f 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java @@ -1,17 +1,34 @@ package biomesoplenty.common.world.features.trees; +import java.util.Arrays; +import java.util.List; import java.util.Random; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; public class WorldGenBrush2 extends WorldGenAbstractTree { - public WorldGenBrush2() + private Block wood; + private Block leaves; + + private int woodMeta; + private int leavesMeta; + + private List soilBlocks; + + public WorldGenBrush2(Block wood, Block leaves, int woodMeta, int leavesMeta, Block... soilBlocks) { super(false); + + this.wood = wood; + this.leaves = leaves; + + this.leavesMeta = leavesMeta; + this.woodMeta = woodMeta; + + this.soilBlocks = Arrays.asList(soilBlocks); } @Override @@ -26,7 +43,7 @@ public class WorldGenBrush2 extends WorldGenAbstractTree //TODO: getBlock() Block block = world.func_147439_a(x, y, z); - if (block != Blocks.grass) + if (!soilBlocks.contains(block)) { return false; } @@ -42,25 +59,27 @@ public class WorldGenBrush2 extends WorldGenAbstractTree } } - //TODO: setBlock() - world.func_147449_b(x, y, z, Blocks.dirt); - world.func_147465_d(x, y + 1, z, Blocks.log, 3, 2); - world.func_147465_d(x, y + 2, z, Blocks.log, 3, 2); - world.func_147465_d(x, y + 3, z, Blocks.log, 3, 2); - world.func_147465_d(x, y + 4, z, Blocks.log, 3, 2); - world.func_147449_b(x + 1, y + 4, z, Blocks.leaves); - world.func_147449_b(x - 1, y + 4, z, Blocks.leaves); - world.func_147449_b(x, y + 4, z + 1, Blocks.leaves); - world.func_147449_b(x, y + 4, z - 1, Blocks.leaves); - world.func_147449_b(x + 1, y + 4, z + 1, Blocks.leaves); - world.func_147449_b(x + 1, y + 4, z - 1, Blocks.leaves); - world.func_147449_b(x - 1, y + 4, z + 1, Blocks.leaves); - world.func_147449_b(x - 1, y + 4, z - 1, Blocks.leaves); - world.func_147449_b(x + 1, y + 5, z, Blocks.leaves); - world.func_147449_b(x - 1, y + 5, z, Blocks.leaves); - world.func_147449_b(x, y + 5, z + 1, Blocks.leaves); - world.func_147449_b(x, y + 5, z - 1, Blocks.leaves); - world.func_147449_b(x, y + 5, z, Blocks.leaves); + //TODO: getBlock() + world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, x, y, z); + //TODO: setBlock() + world.func_147465_d(x, y + 1, z, wood, woodMeta, 2); + world.func_147465_d(x, y + 2, z, wood, woodMeta, 2); + world.func_147465_d(x, y + 3, z, wood, woodMeta, 2); + world.func_147465_d(x, y + 4, z, wood, woodMeta, 2); + world.func_147465_d(x + 1, y + 4, z, leaves, leavesMeta, 2); + world.func_147465_d(x - 1, y + 4, z, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 4, z + 1, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 4, z - 1, leaves, leavesMeta, 2); + world.func_147465_d(x + 1, y + 4, z + 1, leaves, leavesMeta, 2); + world.func_147465_d(x + 1, y + 4, z - 1, leaves, leavesMeta, 2); + world.func_147465_d(x - 1, y + 4, z + 1, leaves, leavesMeta, 2); + world.func_147465_d(x - 1, y + 4, z - 1, leaves, leavesMeta, 2); + world.func_147465_d(x + 1, y + 5, z, leaves, leavesMeta, 2); + world.func_147465_d(x - 1, y + 5, z, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 5, z + 1, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 5, z - 1, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 5, z, leaves, leavesMeta, 2); + return true; } } diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java deleted file mode 100644 index 802b4cff5..000000000 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java +++ /dev/null @@ -1,56 +0,0 @@ -package biomesoplenty.common.world.features.trees; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; - -public class WorldGenChaparral2 extends WorldGenAbstractTree -{ - public WorldGenChaparral2() - { - super(false); - } - - @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; - } - - //TODO: getBlock() - Block block = world.func_147439_a(x, y, z); - - - if (block != Blocks.grass && block != Blocks.sand) - 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; - } - } - - //TODO: setBlock() - world.func_147449_b(x, y, z, Blocks.dirt); - world.func_147449_b(x, y + 1, z, Blocks.log); - world.func_147449_b(x, y + 2, z, Blocks.log); - world.func_147449_b(x + 1, y + 2, z, Blocks.leaves); - world.func_147449_b(x - 1, y + 2, z, Blocks.leaves); - world.func_147449_b(x, y + 2, z + 1, Blocks.leaves); - world.func_147449_b(x, y + 2, z - 1, Blocks.leaves); - world.func_147449_b(x, y + 3, z, Blocks.leaves); - return true; - } - } -} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenMiniShrub.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenMiniShrub.java new file mode 100644 index 000000000..d21d0e712 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenMiniShrub.java @@ -0,0 +1,76 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class WorldGenMiniShrub extends WorldGenAbstractTree +{ + private Block wood; + private Block leaves; + + private int woodMeta; + private int leavesMeta; + + private List soilBlocks; + + public WorldGenMiniShrub(Block wood, Block leaves, int woodMeta, int leavesMeta, Block... soilBlocks) + { + super(false); + + this.wood = wood; + this.leaves = leaves; + + this.leavesMeta = leavesMeta; + this.woodMeta = woodMeta; + + this.soilBlocks = Arrays.asList(soilBlocks); + } + + @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; + } + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (!soilBlocks.contains(block)) + { + 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; + } + } + + //TODO: getBlock() + world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, x, y, z); + //TODO: setBlock() + world.func_147465_d(x, y + 1, z, wood, woodMeta, 2); + world.func_147465_d(x, y + 2, z, wood, woodMeta, 2); + world.func_147465_d(x + 1, y + 2, z, leaves, leavesMeta, 2); + world.func_147465_d(x - 1, y + 2, z, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 2, z + 1, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 2, z - 1, leaves, leavesMeta, 2); + world.func_147465_d(x, y + 3, z, leaves, leavesMeta, 2); + return true; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index ef9d20c5f..59d4ed4ff 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -3,7 +3,6 @@ package biomesoplenty.common.world.generation; import java.util.HashMap; import net.minecraft.init.Blocks; -import net.minecraft.world.gen.feature.WorldGenDoublePlant; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; import net.minecraft.world.gen.feature.WorldGenerator; @@ -11,6 +10,7 @@ import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; 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.WorldGenSplotches; import biomesoplenty.common.world.features.WorldGenWaterReeds; @@ -66,6 +66,7 @@ public class WorldGenFieldAssociation associateField("oasesPerChunk", new WorldGenWaterside(Blocks.grass, 7, Blocks.sand, BOPBlockHelper.get("redRock"))); associateField("minersDelightPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("flowers2"), 6)); associateField("rootsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("plants"), 15)); + associateField("grassSplatterPerChunk", new WorldGenGrassSplatter()); associateField("doubleTallGrassPerChunk", new WorldGenBOPDoubleFlora(Blocks.double_plant, Blocks.double_plant, 2, 8)); associateField("sunflowersPerChunk", new WorldGenBOPDoubleFlora(Blocks.double_plant, Blocks.double_plant, 0, 8));