Examples of TreeGenerator


Examples of com.sk89q.worldedit.util.TreeGenerator

    @CommandPermissions("worldedit.generation.forest")
    @Logging(POSITION)
    @SuppressWarnings("deprecation")
    public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException {
        density = density / 100;
        int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, new TreeGenerator(type));
        player.print(affected + " trees created.");
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.TreeGenerator

        if (type == null) {
            player.printError("Tree type '" + args.getString(0) + "' is unknown.");
            return;
        }

        session.setTool(player.getItemInHand(), new TreePlanter(new TreeGenerator(type)));
        player.print("Tree tool bound to "
                + ItemType.toHeldName(player.getItemInHand()) + ".");
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.TreeGenerator

    @CommandPermissions("worldedit.region.forest")
    @Logging(REGION)
    public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type,
                       @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException {
        density = density / 100;
        ForestGenerator generator = new ForestGenerator(editSession, new TreeGenerator(type));
        GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
        LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
        visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
        Operations.completeLegacy(visitor);
View Full Code Here

Examples of net.glowstone.generator.TreeGenerator

    }

    @Override
    public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
        final BlockStateDelegate blockStateDelegate = new BlockStateDelegate();
        final TreeGenerator generator = new TreeGenerator(blockStateDelegate);
        if (generator.generate(random, loc, type)) {
            final List<BlockState> blockStates = new ArrayList<BlockState>(blockStateDelegate.getBlockStates());
            StructureGrowEvent growEvent = new StructureGrowEvent(loc, type, false, null, blockStates);
            EventFactory.callEvent(growEvent);
            if (!growEvent.isCancelled()) {
                for (BlockState state : blockStates) {
View Full Code Here

Examples of net.glowstone.generator.TreeGenerator

            case DESERT:
            case HELL:
                return;
        }

        final TreeGenerator generator = new TreeGenerator();
        for (int i = 0; i < multiplier; i++) {
            centerX = (source.getX() << 4) + random.nextInt(16);
            centerZ = (source.getZ() << 4) + random.nextInt(16);
            if (random.nextInt(300) < chance) {
                int centerY = world.getHighestBlockYAt(centerX, centerZ) - 1;
                Block sourceBlock = world.getBlockAt(centerX, centerY, centerZ);

                if (sourceBlock.getType() == Material.GRASS) {
                    generator.generate(random, sourceBlock.getLocation().add(0, 1, 0), type);
                }
            }
        }
    }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.tools.tree.TreeGenerator

   {
      super.setUp();
      testGetItemNode = root.addNode("testGetItemNode");
      root.save();
      // geneteting tree maxDepth = 5 and maxWidth = 12
      nGen = new TreeGenerator(testGetItemNode, new WeightNodeGenerator(5, 5));
      nGen.genereteTree();
      validNames = NameTraversingVisitor.getValidNames(testGetItemNode, NameTraversingVisitor.SCOPE_ALL);

      validUuids = NameTraversingVisitor.getValidUuids(testGetItemNode, NameTraversingVisitor.SCOPE_ALL);
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.tools.tree.TreeGenerator

      Node testNode = root.addNode("testNode");
      File checkSummValue = new File(System.getProperty("java.io.tmpdir"), "repo.ssh1");
      BufferedOutputStream sshStrream = new BufferedOutputStream(new FileOutputStream(checkSummValue));
      RandomValueNodeGenerator nodeGenerator =
         new RandomValueNodeGenerator(session.getValueFactory(), 6, 5, 8, 5, 1024 * 1024);
      TreeGenerator generator = new TreeGenerator(testNode, nodeGenerator);
      generator.genereteTree();
      root.save();
      ValueSsh1Generator ssh1Generator = new ValueSsh1Generator(session.getTransientNodesManager(), sshStrream);
      ((NodeImpl)testNode).getData().accept(ssh1Generator);
      sshStrream.close();
      File exportFile = new File(System.getProperty("java.io.tmpdir"), "testExport.xml");
View Full Code Here

Examples of org.terasology.core.world.generator.chunkGenerators.TreeGenerator

        BlockManager blockManager = CoreRegistry.get(BlockManager.class);

        Map<Character, LSystemRule> rules = ImmutableMap.<Character, LSystemRule>builder()
                .put('A', new LSystemRule("[&FFBFA]////[&BFFFA]////[&FBFFA]", 1.0f))
                .put('B', new LSystemRule("[&FFFA]////[&FFFA]////[&FFFA]", 0.8f)).build();
        TreeGenerator oakTree = new TreeGeneratorLSystem("FFFFFFA", rules, 4, (float) Math.toRadians(30)).setLeafType(blockManager.getBlock("core:GreenLeaf"))
                .setBarkType(blockManager.getBlock("core:OakTrunk")).setGenerationProbability(0.08f);

        // Pine
        rules = ImmutableMap.<Character, LSystemRule>builder()
                .put('A', new LSystemRule("[&FFFFFA]////[&FFFFFA]////[&FFFFFA]", 1.0f)).build();
        TreeGenerator pineTree = new TreeGeneratorLSystem("FFFFAFFFFFFFAFFFFA", rules, 4, (float) Math.toRadians(35)).setLeafType(blockManager.getBlock("core:DarkLeaf"))
                .setBarkType(blockManager.getBlock("core:PineTrunk")).setGenerationProbability(0.05f);

        // Birk
        rules = ImmutableMap.<Character, LSystemRule>builder()
                .put('A', new LSystemRule("[&FFFAFFF]////[&FFAFFF]////[&FFFAFFF]", 1.0f))
                .put('B', new LSystemRule("[&FAF]////[&FAF]////[&FAF]", 0.8f)).build();
        TreeGenerator birkTree = new TreeGeneratorLSystem("FFFFAFFFFBFFFFAFFFFBFFFFAFFFFBFF", rules, 4, (float) Math.toRadians(35))
                .setLeafType(blockManager.getBlock("core:DarkLeaf"))
                .setBarkType(blockManager.getBlock("core:BirkTrunk")).setGenerationProbability(0.02f);

        // Oak variation tree
        rules = ImmutableMap.<Character, LSystemRule>builder()
                .put('A', new LSystemRule("[&FFBFA]////[&BFFFA]////[&FBFFAFFA]", 1.0f))
                .put('B', new LSystemRule("[&FFFAFFFF]////[&FFFAFFF]////[&FFFAFFAA]", 0.8f)).build();
        TreeGenerator oakVariationTree = new TreeGeneratorLSystem("FFFFFFA", rules, 4, (float) Math.toRadians(35)).setLeafType(blockManager.getBlock("core:GreenLeaf"))
                .setBarkType(blockManager.getBlock("core:OakTrunk")).setGenerationProbability(0.08f);

        // A red tree
        rules = ImmutableMap.<Character, LSystemRule>builder()
                .put('A', new LSystemRule("[&FFAFF]////[&FFAFF]////[&FFAFF]", 1.0f)).build();
        TreeGenerator redTree = new TreeGeneratorLSystem("FFFFFAFAFAF", rules, 4, (float) Math.toRadians(40)).setLeafType(blockManager.getBlock("core:RedLeaf"))
                .setBarkType(blockManager.getBlock("core:OakTrunk")).setGenerationProbability(0.05f);

        // Cactus
        TreeGenerator cactus = new TreeGeneratorCactus().setTrunkType(blockManager.getBlock("core:Cactus")).setGenerationProbability(0.05f);

        // Add the trees to the generator lists
        treeGeneratorLookup.put(CoreBiome.MOUNTAINS, oakTree);
        treeGeneratorLookup.put(CoreBiome.MOUNTAINS, pineTree);
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.