Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void cylinder(Location loc, Material mat, int r) {
- int cx = loc.getBlockX();
- int cy = loc.getBlockY();
- int cz = loc.getBlockZ();
- World w = loc.getWorld();
- int rSquared = r * r;
- for (int x = cx - r; x <= cx +r; x++) {
- for (int z = cz - r; z <= cz +r; z++) {
- if ((cx - x) * (cx -x) + (cz - z) * (cz - z) <= rSquared) {
- Block b = new Location(World, x, cy, z).getBlock();
- b.setType(mat);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment