Jump to content

MC 1.12.2 getMapcolor


winnetrie

Recommended Posts

I made many variations of existing vanilla blocks and therefore i have an IBlockState argument in my constructor in each class.

For example for stairs and slabs you need to know on what block it is based. So i made a var called modelBlock wich i declare as "modelBlock = state.getBlock();

I use this also to get the mapcolor for the block:

    @Override
    public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        //return ((BlockBaseSlabColoredA.EnumType)state.getValue(COLOR)).getMapColor();
    	return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);
    }

I used another aproach before, wich i commented out. I wanted to have a more/ better approach.

I wonder if this is a good approach since it looks like this getMapColor:

 

return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);

 

Link to comment
Share on other sites

Oh right i see. I changed it to this:

    @Override
    public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        //return ((BlockBaseSlabColoredA.EnumType)state.getValue(COLOR)).getMapColor();
    	//return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);
    	return this.modelState.getMapColor(null, null);
    }

I'm putting "null" for both arguments. I'm not sure this is right, but it feels wrong to enter an IBlockAccess and a BlockPos here.

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.