Java Code Examples for com.flowpowered.math.vector.Vector3i#add()

The following examples show how to use com.flowpowered.math.vector.Vector3i#add() . 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: HiresModelManager.java    From BlueMap with MIT License 5 votes vote down vote up
/**
 * Returns the region of blocks that a tile includes
 */
public AABB getTileRegion(WorldTile tile) {
	Vector3i min = new Vector3i(
			tile.getTile().getX() * tileSize.getX() + gridOrigin.getX(), 
			0, 
			tile.getTile().getY() * tileSize.getY() + gridOrigin.getY()
		);
	Vector3i max = min.add(
			tileSize.getX() - 1,
			255,
			tileSize.getY() - 1
		);
	return new AABB(min, max);
}
 
Example 2
Source File: MapUpdateHandler.java    From BlueMap with MIT License 5 votes vote down vote up
private void updateChunk(UUID world, Vector2i chunkPos) {
	Vector3i min = new Vector3i(chunkPos.getX() * 16, 0, chunkPos.getY() * 16);
	Vector3i max = min.add(15, 255, 15);
	
	Vector3i xmin = new Vector3i(min.getX(), 0, max.getY());
	Vector3i xmax = new Vector3i(max.getX(), 255, min.getY());
	
	//update all corners so we always update all tiles containing this chunk
	synchronized (updateBuffer) {
		updateBlock(world, min);
		updateBlock(world, max);
		updateBlock(world, xmin);
		updateBlock(world, xmax);
	}
}
 
Example 3
Source File: BlockUtil.java    From GriefDefender with MIT License 4 votes vote down vote up
public Vector3i getBlockRelative(Vector3i pos, Direction direction) {
    final Vector3i offset = direction.asBlockOffset();
    return pos.add(offset);
}