Jump to content

Recommended Posts

Posted

I'm trying to do the following:

 

If two blocks from my mod collide by one (or more) faces, then those faces, which collides, shouldn't be rendered.

 

And i have the following problem:

 

Those two block are one next to other and their top and bottom faces a colliding, but the don't become "invisible":

 

 

 

But if move the block above, (1 meter) up, then the top face of the lower block becomes invisible:

 

 

And if the block is "alone", the side renders correctly:

 

 


 

Here is my code

 

@Override
public boolean shouldSideBeRendered(IBlockAccess block, int x, int y, int z, int side)
{
	// -Y
	if(side == 0 && isBlockACamouflage(block.getBlockId(x, y - 1, z)))
	{
		return false;
	}

	// +Y
	if(side == 1 && isBlockACamouflage(block.getBlockId(x, y + 1, z)))
	{
		return false;
	}

	// -Z
	if(side == 2)
	{
		return false;
	}

	else
	{
		return true;
	}
}

 

 

PS: isBlockACamouflage() only check is the block is one added my the mod or not

 

Thanks for helping.

Posted

Hi

 

BlockBreakable::

    * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given

    * coordinates.  Args: blockAccess, x, y, z, side

    public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int x, int y, int z, int side)

    {

        int i1 = par1IBlockAccess.getBlockId(x, y, z);

        return !this.localFlag && i1 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, x, y, z, side);

    }

 

x,y,z is the coordinates of the adjacent block, not the block being rendered.

 

-TGG

Posted

Hi

 

BlockBreakable::

    * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given

    * coordinates.  Args: blockAccess, x, y, z, side

    public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int x, int y, int z, int side)

    {

        int i1 = par1IBlockAccess.getBlockId(x, y, z);

        return !this.localFlag && i1 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, x, y, z, side);

    }

 

x,y,z is the coordinates of the adjacent block, not the block being rendered.

 

-TGG

 

Okay, thanks, it works  ;D

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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