Generating A Hollow Cube With 2 Points.

Discussion in 'Plugin Development' started by killjoy64, Apr 23, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    killjoy64

    Hello, i'm making a plugin that needs to generate an empty hollow cube when someone types /zi define <Arena Name>. I have no problem with the command, just making the hollow cube. I've taken the Block Manipulator from the Huge Bukkit Pluign Tutorial and modified it a bit. But could I have some help making one with 2 points? Like how you can make one with //outline in World Edit. I got it to work with 1 point, here is what I have so far:

    Code:
        public void generateEmpty(Player player, int length){
            World world = player.getWorld();
       
            int x_start = infection.poz1.get(player).getBlockX();
            int y_start = infection.poz1.get(player).getBlockY();
            int z_start = infection.poz1.get(player).getBlockZ();
           
            int x_length = x_start + length;
            int y_length = y_start + length;
            int z_length = z_start + length;
           
            for(int x_operate = 0; x_operate <= x_length; x_operate++){
               
                Block blockToChangeX1 = world.getBlockAt(x_operate, y_start, z_start);
                Block blockToChangex2 = world.getBlockAt(x_operate, y_start, z_length);
                blockToChangeX1.setTypeId(20);
                blockToChangex2.setTypeId(20);
               
                for(int z_operate = 0; z_operate <= z_length; z_operate++){
       
                        Block blockToChangeZ1 = world.getBlockAt(x_start, y_start, z_operate);
                        Block blockToChangeZ2 = world.getBlockAt(x_length, y_start, z_operate);
                        blockToChangeZ1.setTypeId(20);
                        blockToChangeZ2.setTypeId(20);
                       
                        for(int y_operate = 0; y_operate <= y_length; y_operate++){
                            Block blockToChangeY1 = world.getBlockAt(x_start, y_operate, z_operate);
                            Block blockToChangeY2 = world.getBlockAt(x_operate, y_operate, z_start);
                            Block blockToChangeY3 = world.getBlockAt(x_length, y_operate, z_operate);
                            Block blockToChangeY4 = world.getBlockAt(x_operate, y_operate, z_length);
                            Block blockToChangeY5 = world.getBlockAt(x_operate, y_start, z_operate);
                            Block blockToChangeY6 = world.getBlockAt(x_operate, y_length, z_operate);
                           
                            blockToChangeY1.setTypeId(20);
                            blockToChangeY2.setTypeId(20);
                            blockToChangeY3.setTypeId(20);
                            blockToChangeY4.setTypeId(20);   
                            blockToChangeY5.setTypeId(20);
                            blockToChangeY6.setTypeId(20);
                        }
                    }
                }
           
            player.sendMessage("x length was " + x_length);
            player.sendMessage("y length was " + y_length);
            player.sendMessage("z length was " + z_length);
           
            }
    Any help is appreciated thanks! :D
     
Thread Status:
Not open for further replies.

Share This Page