Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mineworld.world.biomes;
- import java.util.Random;
- import mineworld.core.MWBlocks;
- import mineworld.entities.EntityCorruptor;
- import mineworld.world.gen.WorldGenCorruptedTree;
- import mineworld.world.gen.crate.WorldGenCorruptedCrate;
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.entity.Entity;
- import net.minecraft.init.Blocks;
- import net.minecraft.world.World;
- import net.minecraft.world.biome.BiomeGenBase;
- import net.minecraft.world.gen.feature.WorldGenAbstractTree;
- import net.minecraft.world.gen.feature.WorldGenBigMushroom;
- public class BiomeGenCorrupted extends BiomeGenBase
- {
- WorldGenCorruptedTree worldGenTrees = new WorldGenCorruptedTree(false);
- int portal_generated = 0;
- int crate_x, crate_z;
- boolean has_crate_spawned;
- public BiomeGenCorrupted(int par1)
- {
- super(par1);
- this.portal_generated = 0;
- //this.theBiomeDecorator.treesPerChunk = 5;
- this.setHeight(BiomeGenBase.height_MidHills);
- this.topBlock = MWBlocks.corrupted_grass;
- //this.topBlock = Blocks.grass;
- this.fillerBlock = MWBlocks.corrupted_dirt;
- Random rand = new Random();
- this.crate_x = 200 + rand.nextInt(56);
- this.crate_z = 200 + rand.nextInt(56);
- this.has_crate_spawned = false;
- }
- public WorldGenAbstractTree getRandomWorldGenForTrees(Random par1)
- {
- return (WorldGenAbstractTree) worldGenTrees;
- }
- public void decorate(World par1World, Random par2Random, int par3, int par4)
- {
- int k;
- int l;
- int i1;
- int j1;
- int k1;
- for (k = 0; k < 2; ++k)
- {
- for (l = 0; l < 2; ++l)
- {
- i1 = par3 + k * 4 + 1 + 8 + par2Random.nextInt(3);
- j1 = par4 + l * 4 + 1 + 8 + par2Random.nextInt(3);
- k1 = par1World.getHeightValue(i1, j1);
- if (par2Random.nextInt(20) == 0)
- {
- WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom();
- worldgenbigmushroom.generate(par1World, par2Random, i1, k1, j1);
- }
- else
- {
- WorldGenAbstractTree worldgenabstracttree = this.getRandomWorldGenForTrees(par2Random);
- worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D);
- if (worldgenabstracttree.generate(par1World, par2Random, i1, k1, j1))
- {
- worldgenabstracttree.func_150524_b(par1World, par2Random, i1, k1, j1);
- }
- }
- }
- }
- Entity corrupter = par1World.getEntityByID(new EntityCorruptor(par1World).getEntityId());
- if(corrupter == null)
- {
- int j = 80;
- if(this.has_crate_spawned == false)
- {
- System.out.println("Crate generated at: " + crate_x + " par1World.getTopSolidOrLiquidBlock(crate_x, crate_z) " + crate_z);
- new WorldGenCorruptedCrate().generate(par1World, par2Random, crate_x, par1World.getTopSolidOrLiquidBlock(crate_x, crate_z), crate_z);
- this.has_crate_spawned = true;
- }
- }
- super.decorate(par1World, par2Random, par3, par4);
- }
- @Override
- public void genTerrainBlocks(World world, Random random, Block[] blocks, byte[] bytes, int int1, int int2, double d) {
- boolean flag = true;
- Block block = this.topBlock;
- byte b0 = (byte)(this.field_150604_aj & 255);
- Block block1 = this.fillerBlock;
- int k = -1;
- int l = (int)(d / 3.0D + 3.0D + random.nextDouble() * 0.25D);
- int i1 = int1 & 15;
- int j1 = int2 & 15;
- int k1 = blocks.length / 256;
- for (int l1 = 255; l1 >= 0; --l1)
- {
- int i2 = (j1 * 16 + i1) * k1 + l1;
- if (l1 <= 0 + random.nextInt(5))
- {
- blocks[i2] = Blocks.bedrock;
- }
- else
- {
- Block block2 = blocks[i2];
- if (block2 != null && block2.getMaterial() != Material.air)
- {
- if (block2 == MWBlocks.corrupted_stone || block2 == Blocks.grass || block2 == Blocks.stone)
- {
- if (k == -1)
- {
- if (l <= 0)
- {
- block = null;
- b0 = 0;
- block1 = MWBlocks.corrupted_grass;
- }
- else if (l1 >= 59 && l1 <= 64)
- {
- block = this.topBlock;
- b0 = (byte)(this.field_150604_aj & 255);
- block1 = this.fillerBlock;
- }
- if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
- {
- if (this.getFloatTemperature(int1, l1, int2) < 0.15F)
- {
- block = Blocks.ice;
- b0 = 0;
- }
- else
- {
- block = MWBlocks.corrupted_water;
- b0 = 0;
- }
- }
- k = l;
- if (l1 >= 62)
- {
- blocks[i2] = block;
- bytes[i2] = b0;
- }
- else if (l1 < 56 - l)
- {
- block = null;
- block1 = MWBlocks.corrupted_dirt;
- blocks[i2] = Blocks.gravel;
- }
- else
- {
- blocks[i2] = block1;
- }
- }
- else if (k > 0)
- {
- --k;
- blocks[i2] = block1;
- if (k == 0 && block1 == Blocks.sand)
- {
- k = random.nextInt(4) + Math.max(0, l1 - 63);
- block1 = Blocks.sandstone;
- }
- }
- }
- if(block2 == Blocks.dirt)
- {
- block = null;
- b0 = 0;
- block1 = MWBlocks.corrupted_dirt;
- }
- if(block2 == Blocks.water || block2 == Blocks.flowing_water)
- {
- block = null;
- b0 = 0;
- block1 = MWBlocks.corrupted_water;
- }
- }
- else
- {
- k = -1;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement