Package net.minecraft.world.gen.feature

Examples of net.minecraft.world.gen.feature.WorldGenerator


        if (world.isRemote)
            return false;

        int meta = world.getBlockMetadata(x, y, z);
        world.setBlockToAir(x, y, z);
        WorldGenerator obj = null;

        if (meta == 0)
        {
            obj = new GlowshroomGenBlueGreen(true, 0);
        }
        if (meta == 1)
        {
            obj = new GlowshroomGenPurple(true);
        }
        if (meta == 2)
        {
            obj = new GlowshroomGenBlueGreen(true, 1);
        }

        /*if (this.blockID == Block.mushroomBrown.blockID)
        {
            worldgenbigmushroom = new WorldGenBigMushroom(0);
        }
        else if (this.blockID == Block.mushroomRed.blockID)
        {
            worldgenbigmushroom = new WorldGenBigMushroom(1);
        }*/

        if (obj != null && obj.generate(world, random, x, y, z))
        {
            return true;
        }
        else
        {
View Full Code Here


            }
            if (random.nextInt(35) == 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    WorldGenerator obj = random.nextInt(3) == 0 ? purpleGlowshroom : blueGreenGlowshroom;
                    xSpawn = xPos + random.nextInt(24) - 4;
                    zSpawn = zPos + random.nextInt(24) - 4;
                    ySpawn = findGround(world, xSpawn, random.nextInt(64) + 32, zSpawn);
                    if (ySpawn != -1)
                    {
                        obj.generate(world, random, xSpawn, ySpawn, zSpawn);
                    }
                }
            }
        }
    }
View Full Code Here

    public void func_149878_d (World world, int x, int y, int z, Random random)
    {
        int md = world.getBlockMetadata(x, y, z) % 8;
        world.setBlock(x, y, z, Blocks.air);
        WorldGenerator obj = null;

        if (md == 1)
            obj = new RareTreeGen(true, 4, 2, 1, 1);

        else if (md == 2)
            obj = new RareTreeGen(true, 9, 8, 2, 2);

        else if (md == 3)
            obj = new RareTreeGen(true, 6, 4, 3, 3);

        else if (md == 4)
            obj = new WillowGen(true);

        else
            obj = new RareTreeGen(true, 4, 2, 0, 0);

        if (!(obj.generate(world, random, x, y, z)))
            world.setBlock(x, y, z, this, md + 8, 3);
    }
View Full Code Here

   
    public void func_149878_d(World world, int x, int y, int z, Random random)
    {
        int md = world.getBlockMetadata(x, y, z) % 8;
        world.setBlock(x, y, z, Blocks.air);
        WorldGenerator obj = null;

        if (md == 1)
            obj = new EucalyptusTreeGenShort(0, 1);

        else if (md == 2)
            obj = new BushTreeGen(true, 2, 3, 2);

        else if (md == 3)
            obj = new SakuraTreeGen(true, 1, 0);

        else if (md == 4)
            obj = new WhiteTreeGen(true, 2, 1);

        else if (md == 5)
            obj = new BloodTreeLargeGen(3, 2);

        else if (md == 6)
            obj = new DarkwoodGen(true, 3, 0);

        else if (md == 7)
            obj = new FusewoodGen(true, 3, 1);

        else
            obj = new RedwoodTreeGen(true, NContent.redwood);

        if (!(obj.generate(world, random, x, y, z)))
            world.setBlock(x, y, z, this, md + 8, 3);
    }
View Full Code Here

    }
   
    public void growTree(World world, int x, int y, int z, Random rand)
    {
        final int metadata = unmarkedMetadata(world.getBlockMetadata(x, y, z));
        WorldGenerator tree = null;
        int x1 = 0;
        int z1 = 0;
        boolean isHuge = false;
        int offset = 0;
       
        final boolean isForestryFarmed = world.getBlock(x, y - 1, z) == forestrySoil;
       
        if (metadata == BlockType.UMBER.metadata())
        {
            if (rand.nextInt(3) != 0)
            {
                tree = new WorldGenBigAutumnTree(true, AutumnTreeType.BROWN);
               
                WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
            else
            {
                tree = new WorldGenAutumnTree(true, AutumnTreeType.BROWN);
               
                WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
        }
        else if (metadata == BlockType.GOLDENROD.metadata())
        {
            if (rand.nextInt(3) != 0)
            {
                tree = new WorldGenBigAutumnTree(true, AutumnTreeType.ORANGE);
               
                WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
            else
            {
                tree = new WorldGenAutumnTree(true, AutumnTreeType.ORANGE);
               
                WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
        }
        else if (metadata == BlockType.VERMILLION.metadata())
        {
            if (rand.nextInt(3) != 0)
            {
                tree = new WorldGenBigAutumnTree(true, AutumnTreeType.PURPLE);
               
                WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
            else
            {
                tree = new WorldGenAutumnTree(true, AutumnTreeType.PURPLE);
               
                WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
        }
        else if (metadata == BlockType.CITRINE.metadata())
        {
            if (rand.nextInt(3) != 0)
            {
                tree = new WorldGenBigAutumnTree(true, AutumnTreeType.YELLOW);
               
                WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
            else
            {
                tree = new WorldGenAutumnTree(true, AutumnTreeType.YELLOW);
               
                WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
            }
        }
        else if (metadata == BlockType.ACACIA.metadata())
        {
            tree = new WorldGenAcacia(true);
        }
        else if (metadata == BlockType.CYPRESS.metadata())
        {
            tree = new WorldGenCypressTree(true);
        }
        else
        {
            // Check for 2x2 firs and redwoods
            for (x1 = 0; x1 >= -1; --x1)
            {
                for (z1 = 0; z1 >= -1; --z1)
                    if (isSameSapling(world, x + x1, y, z + z1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1, metadata) && isSameSapling(world, x + x1, y, z + z1 + 1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1 + 1, metadata))
                    {
                        if (metadata == BlockType.FIR.metadata())
                        {
                            tree = new WorldGenFirTreeHuge(true);
                            offset = 1;
                        }
                        else
                        {
                            tree = GeneralSettings.useLegacyRedwoods ? new WorldGenRedwood(true) : new WorldGenNewRedwood(true);
                            offset = 0;
                        }
                        isHuge = true;
                        break;
                    }
                if (tree != null)
                    break;
            }
            if (tree == null && metadata == BlockType.FIR.metadata())
            {
                // Single fir sapling generates 1x1 tree
                z1 = 0;
                x1 = 0;
                tree = new WorldGenFirTree(true);
            }
        }
       
        if (tree != null)
        {
            if (isHuge)
            {
                world.setBlock(x + x1, y, z + z1, Blocks.air);
                world.setBlock(x + x1 + 1, y, z + z1, Blocks.air);
                world.setBlock(x + x1, y, z + z1 + 1, Blocks.air);
                world.setBlock(x + x1 + 1, y, z + z1 + 1, Blocks.air);
            }
            else
                world.setBlock(x, y, z, Blocks.air);
           
            if (!tree.generate(world, rand, x + x1 + offset, y, z + z1 + offset))
            {
                if (isHuge)
                {
                    world.setBlock(x + x1, y, z + z1, this, metadata, 3);
                    world.setBlock(x + x1 + 1, y, z + z1, this, metadata, 3);
View Full Code Here

    }
   
    public void growTree(World world, int x, int y, int z, Random rand)
    {
        final int metadata = unmarkedMetadata(world.getBlockMetadata(x, y, z));
        WorldGenerator tree = null;
        int x1 = 0;
        int z1 = 0;
        boolean isHuge = false;
       
        final boolean isForestryFarmed = world.getBlock(x, y - 1, z) == forestrySoil;
       
        if (metadata == BlockType.BALD_CYPRESS.metadata() || metadata == BlockType.RAINBOW_EUCALYPTUS.metadata())
        {
            for (x1 = 0; x1 >= -1; --x1)
            {
                for (z1 = 0; z1 >= -1; --z1)
                    if (isSameSapling(world, x + x1, y, z + z1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1, metadata) && isSameSapling(world, x + x1, y, z + z1 + 1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1 + 1, metadata))
                    {
                        if (metadata == BlockType.BALD_CYPRESS.metadata())
                        {
                            tree = new WorldGenBaldCypressTree(true);
                        }
                        else
                        {
                            tree = new WorldGenRainbowEucalyptusTree(true);
                        }
                        isHuge = true;
                        break;
                    }
                if (tree != null)
                    break;
            }
        }
        else if (metadata == BlockType.JAPANESE_MAPLE.metadata())
        {
            tree = new WorldGenJapaneseMapleTree(true);
        }
        else if (metadata == BlockType.SAKURA_BLOSSOM.metadata())
        {
            tree = new WorldGenSakuraBlossomTree(true);
        }
        else
        {
            tree = new WorldGenJapaneseMapleShrub(true);
        }
       
        if (tree != null)
        {
            if (isHuge)
            {
                world.setBlock(x + x1, y, z + z1, Blocks.air);
                world.setBlock(x + x1 + 1, y, z + z1, Blocks.air);
                world.setBlock(x + x1, y, z + z1 + 1, Blocks.air);
                world.setBlock(x + x1 + 1, y, z + z1 + 1, Blocks.air);
            }
            else
            {
                world.setBlock(x, y, z, Blocks.air);
            }
           
            if (!tree.generate(world, rand, x + x1, y, z + z1))
            {
                if (isHuge)
                {
                    world.setBlock(x + x1, y, z + z1, this, metadata, 3);
                    world.setBlock(x + x1 + 1, y, z + z1, this, metadata, 3);
View Full Code Here

    }
   
  public void registerBlock(Block block, Collection<BlockType> types) {
    for( BlockCustomFlower.BlockType type : types ) {
      // special cases
      final WorldGenerator gen;
      switch( type ) {
        case ROOT:
          gen = new WorldGenRoot(block, type.metadata());
          break;
        case TINY_CACTUS:
View Full Code Here

  }

  // special gen for wild crops
  public void registerCrop(Element element) {
    if (element.isPresent()) {
      final WorldGenerator gen = new WorldGenMetadataFlowers(
          Block.getBlockFromItem(element.get().getItem()), BlockCropBasic.MAX_GROWTH_STAGE);
      cropGens.put(element, gen);
    }
  }
View Full Code Here

    }
    list.add(type);
  }
   
  protected int applyGenerator(BlockType type, World world, int chunkX, int chunkZ, Random rand, int times) {
    final WorldGenerator gen = flowerGens.get(type);
    int count = 0;
    if (gen != null) {
      for (int i = 0; i < times; ++i) {
        final int x = chunkX + rand.nextInt(16) + 8;
        final int y = rand.nextInt(128);
        final int z = chunkZ + rand.nextInt(16) + 8;
        if (gen.generate(world, rand, x, y, z)) ++count;
      }
    }
    return count;
  }
View Full Code Here

    }
    return count;
  }

  protected boolean applyGenerator(BlockType type, World world, int chunkX, int chunkZ, Random rand) {
    final WorldGenerator gen = flowerGens.get(type);
    if (gen != null) {
      return applyGenerator(gen, world, chunkX, chunkZ, rand);
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of net.minecraft.world.gen.feature.WorldGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.