Jump to content

[Solved] [1.11] Weird transparency issue


Recommended Posts

Posted (edited)

I make a block that has a partially transparent texture and I want it be clear like glass is. I copied the glass code and now my block sees right through the ground. How would I fix this?

 

Here is pictures of this and my code:

 

http://image.prntscr.com/image/a8f16eeef55a43c6bbf48f06e431de65.png

 

http://image.prntscr.com/image/c12682e8b9a34e24aadc3829689e1884.png

 

The block code:


public class BlockMachineFrame extends BlockBase {
    public BlockMachineFrame() {
        super(Material.IRON, "machine_frame");

        setHardness(3f);
        setResistance(5f);
        setHarvestLevel("pickaxe", 0);
    }

    @Override
    public BlockMachineFrame setCreativeTab(CreativeTabs tab) {
        super.setCreativeTab(tab);
        return this;
    }

    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.CUTOUT;
    }

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

 

The blockstate file:


{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "roboticraft:blocks/machine_frame"
    }
  },
  "variants": {
    "normal": {
      "model": "cube_all"
    },
    "inventory": {
      "model": "cube_all"
    }
  }
}
Edited by Awesome_Spider
Posted

Try to override:

 public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {}

 

In the BlockGlass class you can see its extends from BlockBreakable which override this too.

Posted

Lhykos: that says whether or not this block renders sides, not adjacent blocks.

 

This is what's missing:

	@Override
	public boolean isOpaqueCube(IBlockState state) {
		return false;
	}

Also, make sure you annotate all override methods with @Override

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 minute ago, Draco18s said:

This is what's missing:


	@Override
	public boolean isOpaqueCube(IBlockState state) {
		return false;
	}

 

Ok, thanks for the help.

 

2 minutes ago, Draco18s said:

Also, make sure you annotate all override methods with @Override

Oops. I knew that, just missed one of them.

Posted
9 minutes ago, Awesome_Spider said:

Oops. I knew that, just missed one of them.

Two, actually: isFullCube and BlockRenderLayer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.