Examples of WorldGenerator


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

   
    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

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

    }
   
    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

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

    }
   
    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

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

    }
   
  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

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

  }

  // 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

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

    }
    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

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

    }
    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

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

        || biomeCheck(BiomeSettings.FORESTEDISLAND, biome)
        || biomeCheck(BiomeSettings.BIRCHFOREST, biome)
        || biomeCheck(BiomeSettings.PINEFOREST, biome)
        || biomeCheck(BiomeSettings.MEADOW, biome)
        || biomeCheck(BiomeSettings.WOODLANDS, biome)) {
      final WorldGenerator gen = cropGens.get(Element.PLANT_STRAWBERRY);
      for (int x = 0; x < 4; ++x)
        applyGenerator(gen, world, chunkX, chunkZ, rand);
    }
    }
View Full Code Here

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

        {
            @Override
            public boolean generate(World world, Random rand, int x, int y, int z)
            {
              // TODO: Check correct generation
                final WorldGenerator worldGen = new WorldGenMegaJungle(false, 10 + rand.nextInt(20), 0, 3, 3);
                return worldGen.generate(world, rand, x, y, z);
            }
           
        }, 6);
        addWeightedTreeGenForBiome(biome.get(), new WorldGenAbstractTree(false)
        {
            @Override
            public boolean generate(World world, Random rand, int x, int y, int z)
            {
                final WorldGenerator worldGen = new WorldGenTrees(false, 4 + rand.nextInt(7), 3, 3, true);
                return worldGen.generate(world, rand, x, y, z);
            }
        }, 12);
    }
View Full Code Here

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

        addWeightedTreeGenForBiome(biome.get(), new WorldGenAbstractTree(false)
        {
            @Override
            public boolean generate(World world, Random rand, int x, int y, int z)
            {
                final WorldGenerator worldGen = new WorldGenShrub(3, rand.nextInt(3));
                return worldGen.generate(world, rand, x, y, z);
            }
        }, 50);
        addWeightedTreeGenForBiome(biome.get(), JAPANESE_MAPLE_SHRUB_GEN, 50);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.