Jump to content

[1.10] custom thin block is causing 'x-ray' effects.


needoriginalname

Recommended Posts

I am creating a new block that has the height and width of a Trapdoor.

However, for some reason, when I place down the block, all side of the block is was placing on, are see through as if I was spectating or was using x-ray and can see through the block.

 

Here is a link to a screenshot I took:

 

Also, here is a link to my code: https://github.com/needoriginalname/bitsandpieces/blob/master/src/main/java/com/needoriginalname/bitsandpieces/blocks/BlockItemGate.java

 

Any thing I am missing, I feel its something very obvious for non-full blocks but this is my first time making such a block.

Link to comment
Share on other sites

Override the

isOpaqueCube

method to return false.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I am using Minecraft 1.10 (forgot to add that)

 

Putting isOpaqueCube to false does seem to fix things being see-through. However, problem now seems to be lighting and also just found out entities can suffocate in it. I checked the bounding box and collision box, its correct.

 

PS: image was updated as of 1:30 est because showed wrong pic

Link to comment
Share on other sites

I believe they are getting rid of anything that looks like this too:

 

import javax.annotation.Nullable;

 

but I don't see

@nullable anywhere in the class BlockItemGate.java

 

Removing that is a good thing too.

 

Here is an example of a block that is like glass, is solid, but does not swiss cheese, it extends the BlockBreakable class.

 

public class example_portal_block extends BlockBreakable {
public example_portal_block() {
	super(Material.ROCK, isFullCube(true), MapColor.AIR);
	setUnlocalizedName(Reference.EBlocks.exampleblock.getUnlocalizedName());
	setRegistryName(Reference.EBlocks.exampleblock.getRegistryName());
	this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
public static boolean isFullCube(boolean  B) {		
	return true;
}
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.TRANSLUCENT;
    }
    public boolean blocksLight()
    {
        return false;
    }
    public boolean isSolid()
    {
        return false;
    }
public MapColor getMapColor(IBlockState state)
    {
        return MapColor.AIR;
    }
public boolean isOpaqueCube()
    {
        return false;
    }

 

 

Here is another example that swiss cheeses, it extends block:

 

public class example_block extends Block {
public example_portal_block() {
	super(Material.ROCK);
	setUnlocalizedName(Reference.EBlocks.exampleblock.getUnlocalizedName());
	setRegistryName(Reference.EBlocks.exampleblock.getRegistryName());
	this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
public static boolean isFullCube()
{		
	return true;
}
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.TRANSLUCENT;
    }
    public boolean blocksLight()
    {
        return false;
    }
    public boolean isSolid()
    {
        return false;
    }
public MapColor getMapColor(IBlockState state)
    {
        return MapColor.AIR;
    }
}

 

Link to comment
Share on other sites

I am using Minecraft 1.10 (forgot to add that)

 

Putting isOpaqueCube to false does seem to fix things being see-through. However, problem now seems to be lighting and also just found out entities can suffocate in it. I checked the bounding box and collision box, its correct.

 

PS: image was updated as of 1:30 est because showed wrong pic

Try overriding

	
public boolean isFullCube(IBlockState state)
{
return false;
}

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.

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.