@Override
	public int getMask(int plane, int localX, int localY) {
		int currentChunkX = localX / 8;
		int currentChunkY = localY / 8;
		int rotation = regionCoords[plane][currentChunkX][currentChunkY][3];
		int realChunkX = regionCoords[plane][currentChunkX][currentChunkY][0];
		int realChunkY = regionCoords[plane][currentChunkX][currentChunkY][1];
		if (realChunkX == 0 || realChunkY == 0)
			return -1;
		int realRegionId = (((realChunkX / 8) << 8) + (realChunkY / 8));
		Region region = World.getRegion(realRegionId, true);
		if (region instanceof DynamicRegion) {
			if (Settings.DEBUG)
				Logger.log(this,
						"YOU CANT MAKE A REAL MAP AREA INTO A DYNAMIC REGION!, IT MAY DEADLOCK!");
			return -1; // no information so that data not loaded
		}
		int realRegionOffsetX = (realChunkX - ((realChunkX / 8) * 8));
		int realRegionOffsetY = (realChunkY - ((realChunkY / 8) * 8));
		int posInChunkX = (localX - (currentChunkX * 8));
		int posInChunkY = (localY - (currentChunkY * 8));
		if (rotation != 0) {
			for (int rotate = 0; rotate < (4 - rotation); rotate++) {
				int fakeChunckX = posInChunkX;
				int fakeChunckY = posInChunkY;
				posInChunkX = fakeChunckY;
				posInChunkY = 7 - fakeChunckX;
			}
		}
		int realLocalX = (realRegionOffsetX * 8) + posInChunkX;
		int realLocalY = (realRegionOffsetY * 8) + posInChunkY;
		return region.getMask(
				regionCoords[plane][currentChunkX][currentChunkY][2],
				realLocalX, realLocalY);
	}