Java Code Examples for com.sk89q.worldedit.regions.Polygonal2DRegion#getMinimumY()

The following examples show how to use com.sk89q.worldedit.regions.Polygonal2DRegion#getMinimumY() . 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: Polygonal2DRegionXMLCodec.java    From HeavySpleef with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void apply(Element applyTo, Polygonal2DRegion region) {
	List<BlockVector2D> points = region.getPoints();
	int minY = region.getMinimumY();
	int maxY = region.getMaximumY();
	
	Element pointsElement = applyTo.addElement("points");
	for (BlockVector2D point : points) {
		Element pointElement = pointsElement.addElement("point");
		
		pointElement.addElement("x").addText(String.valueOf(point.getBlockX()));
		pointElement.addElement("z").addText(String.valueOf(point.getBlockZ()));
	}
	
	applyTo.addElement("minY").addText(String.valueOf(minY));
	applyTo.addElement("maxY").addText(String.valueOf(maxY));
}
 
Example 2
Source File: Polygonal2DRegionSchematicCodec.java    From HeavySpleef with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void apply(Map<String, Tag> tags, Polygonal2DRegion region) {
	List<BlockVector2D> points = region.getPoints();
	int minY = region.getMinimumY();
	int maxY = region.getMaximumY();
	
	List<ListTag> pointList = Lists.newArrayList();
	for (BlockVector2D vector : points) {
		List<IntTag> vectorList = Lists.newArrayList();
		vectorList.add(new IntTag(vector.getBlockX()));
		vectorList.add(new IntTag(vector.getBlockZ()));
		
		ListTag vectorListTag = new ListTag(IntTag.class, vectorList);
		pointList.add(vectorListTag);
	}
	
	ListTag pointListTag = new ListTag(ListTag.class, pointList);
	
	tags.put("points", pointListTag);
	tags.put("minY", new IntTag(minY));
	tags.put("maxY", new IntTag(maxY));
}