Java Code Examples for com.sk89q.worldedit.regions.CylinderRegion#getRadius()
The following examples show how to use
com.sk89q.worldedit.regions.CylinderRegion#getRadius() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CylinderSpawnpointGenerator.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
@Override public void generateSpawnpoints(CylinderRegion region, World world, List<Location> spawnpoints, int n) { Vector center = region.getCenter(); Vector2D radius = region.getRadius(); int radx = radius.getBlockX(); int radz = radius.getBlockZ(); int y = region.getMaximumY() + 1; for (int i = 0; i < n; i++) { double a = Math.random() * 2 * Math.PI; double randomradx = Math.random() * radx; double randomradz = Math.random() * radz; int rx = (int) (randomradx * Math.sin(a)); int rz = (int) (randomradz * Math.cos(a)); int px = center.getBlockX() + rx; int pz = center.getBlockZ() + rz; Location location = new Location(world, px, y, pz); spawnpoints.add(location); } }
Example 2
Source File: CylinderRegionXMLCodec.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
@Override public void apply(Element applyTo, CylinderRegion region) { Vector center = region.getCenter(); Vector2D radius = region.getRadius(); int minY = region.getMinimumY(); int maxY = region.getMaximumY(); Element centerElement = applyTo.addElement("center"); centerElement.addElement("x").addText(String.valueOf(center.getBlockX())); centerElement.addElement("y").addText(String.valueOf(center.getBlockY())); centerElement.addElement("z").addText(String.valueOf(center.getBlockZ())); Element radiusElement = applyTo.addElement("radius"); radiusElement.addElement("x").addText(String.valueOf(radius.getBlockX())); radiusElement.addElement("z").addText(String.valueOf(radius.getBlockZ())); applyTo.addElement("minY").addText(String.valueOf(minY)); applyTo.addElement("maxY").addText(String.valueOf(maxY)); }
Example 3
Source File: CylinderRegionSchematicCodec.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
@Override public void apply(Map<String, Tag> tags, CylinderRegion region) { Vector center = region.getCenter(); Vector2D radius = region.getRadius(); int minY = region.getMinimumY(); int maxY = region.getMaximumY(); List<IntTag> centerList = Lists.newArrayList(); centerList.add(new IntTag(center.getBlockX())); centerList.add(new IntTag(center.getBlockY())); centerList.add(new IntTag(center.getBlockZ())); ListTag centerTag = new ListTag(IntTag.class, centerList); List<IntTag> radiusList = Lists.newArrayList(); radiusList.add(new IntTag(radius.getBlockX())); radiusList.add(new IntTag(radius.getBlockZ())); ListTag radiusTag = new ListTag(IntTag.class, radiusList); tags.put("center", centerTag); tags.put("radius", radiusTag); tags.put("minY", new IntTag(minY)); tags.put("maxY", new IntTag(maxY)); }