Jump to content

Water flow direction


Recommended Posts

thx a lot :)


for anyone who also wants to know which way the water is flowing here is the code i made:

public static ForgeDirection getWaterFlowDirection(World par1, int par2, int par3, int par4){
	int var1 = par1.getBlockMetadata(par2, par3, par4);

	if(par1.getBlockId(par2, par3, par4) != Block.waterStill.blockID || var1 == 0){
		return null;

	for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
		int x = par2 + direction.offsetX;
		int y = par3 + direction.offsetY;
		int z = par4 + direction.offsetZ;
		int var2 = par1.getBlockId(x, y, z);
		if(var2 == Block.waterStill.blockID){
			int var3 = par1.getBlockMetadata(x, y, z);
			if(var3 > var1){
				return direction;

	return ForgeDirection.UNKNOWN;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.