//Bitmask
//0000
//NESW
byte bitmaskEdges = 0
Get tile and check tileNorth, tileEast, tileWest
Get NorthFacingTilesToPlace
if tileCurrent Z is above -125
tileCurrent is not water, skip tileCurrent
Check neighbour tileNorth
If Z is above -125
tileNorth is an edge
bitmaskEdges[0] = 1
Check neighbour tileEast
If Z is above -125
tileEast is an edge
bitmaskEdges[1] = 1
Check neighbour tileWest
If Z is above -125
tileWest is an edge
bitmaskEdges[3] = 1
if bitMaskEdges > 0
Add tile and bitmask to list
End
GetSouthFacingTiles
Same as above but check for tileSouth, tileEast, tileWest
End
//Bitmask
//0000
//NESW
byte bitmaskEdges = 0
Get tile and check tileNorth, tileEast, tileWest
Get NorthFacingTilesToPlace
if tileCurrent Z is above -125
tileCurrent is not water, skip tileCurrent
Check neighbour tileNorth
If Z is above -125
tileNorth is an edge
bitmaskEdges[0] = 1
Check neighbour tileEast
If Z is above -125
tileEast is an edge
bitmaskEdges[1] = 1
Check neighbour tileWest
If Z is above -125
tileWest is an edge
bitmaskEdges[3] = 1
if bitMaskEdges > 0
Add tile and bitmask to list
End
GetSouthFacingTiles
Same as above but check for tileSouth, tileEast, tileWest
End