Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void generateCube(Location point, int length){ // public visible method generateCube() with 2 parameters point and location
- World world = point.getWorld();
- int x_start = point.getBlockX(); // Set the startpoints to the coordinates of the given location
- int y_start = point.getBlockY(); // I use getBlockX() instead of getX() because it gives you a int value and so you dont have to cast it with (int)point.getX()
- int z_start = point.getBlockZ();
- int x_lenght = x_start + length; // now i set the lenghts for each dimension... should be clear.
- int y_lenght = y_start + length;
- int z_lenght = z_start + length;
- for(int x_operate = x_start; x_operate <= x_length; x_operate++){
- // Loop 1 for the X-Dimension "for x_operate (which is set to x_start)
- //do whats inside the loop while x_operate is
- //<= x_length and after each loop increase
- //x_operate by 1 (x_operate++ is the same as x_operate=x_operate+1;)
- for(int y_operate = y_start; y_operate <= y_length; y_operate++){// Loop 2 for the Y-Dimension
- for(int z_operate = z_start; z_operate <= z_length; z_operate++){// Loop 3 for the Z-Dimension
- Block blockToChange = world.getBlockAt(x_operate,y_operate,z_operate); // get the block with the current coordinates
- blockToChange.setTypeId(34); // set the block to Type 34
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement