Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

IBlockColor not changing color of block


Recommended Posts

I register an IBlockColor like this:

Minecraft.getInstance().getBlockColors().register(new CakeColor(0xad6b15), block); //Cake color implements IBlockColor and its method

 

The getColor method is setup like this:

@Override
    public int getColor(BlockState p_getColor_1_, @Nullable IBlockDisplayReader p_getColor_2_, @Nullable BlockPos p_getColor_3_, int p_getColor_4_) {
        return color; // Returns the same color regardless of state
    }

Yet the color of my cake still uses the base texture when placed on the ground. I need the color to change.

Link to post
Share on other sites
22 hours ago, NullDev said:

I register an IBlockColor like this:


Minecraft.getInstance().getBlockColors().register(new CakeColor(0xad6b15), block); //Cake color implements IBlockColor and its method

 

That is incorrect. Use ColorHandlerEvent.Block.

 

22 hours ago, NullDev said:

Yet the color of my cake still uses the base texture when placed on the ground. I need the color to change.

Show your model JSON and texture.

Link to post
Share on other sites
On 2/20/2021 at 12:01 PM, diesieben07 said:

That is incorrect. Use ColorHandlerEvent.Block.

I am now registering the colors using that event, but nothing has changed. I even have the event logging to the console to check that it is working.

On 2/20/2021 at 12:01 PM, diesieben07 said:

Show your model JSON and texture.

Blockstate:

{
  "variants": {
    "bites=0": {
      "model": "tons_of_cakes:block/cake"
    },
    "bites=1": {
      "model": "tons_of_cakes:block/cake_slice1"
    },
    "bites=2": {
      "model": "tons_of_cakes:block/cake_slice2"
    },
    "bites=3": {
      "model": "tons_of_cakes:block/cake_slice3"
    },
    "bites=4": {
      "model": "tons_of_cakes:block/cake_slice4"
    },
    "bites=5": {
      "model": "tons_of_cakes:block/cake_slice5"
    },
    "bites=6": {
      "model": "tons_of_cakes:block/cake_slice6"
    }
  }
}

cake.json:

{
  "parent": "block/cake_slice1",
  "textures": {
    "down": "tons_of_cakes:blocks/cake_bottom",
    "up": "tons_of_cakes:blocks/cake_top",
    "north": "tons_of_cakes:blocks/cake_side",
    "south": "tons_of_cakes:blocks/cake_side",
    "east": "tons_of_cakes:blocks/cake_side",
    "west": "tons_of_cakes:blocks/cake_inside"
  }
}

cake_slice1:

{
  "parent": "block/cake_slice1",
  "textures": {
    "down": "tons_of_cakes:blocks/cake_bottom",
    "up": "tons_of_cakes:blocks/cake_top",
    "north": "tons_of_cakes:blocks/cake_side",
    "south": "tons_of_cakes:blocks/cake_side",
    "east": "tons_of_cakes:blocks/cake_side",
    "west": "tons_of_cakes:blocks/cake_inside"
  }
}

and the textures it is referencing are black and white versions of the vanilla textures, but it doesn't even show as black and white in game. It shows as the original vanilla texture.

Link to post
Share on other sites
4 hours ago, NullDev said:

It shows as the original vanilla texture.

You set the vanilla cake_slice1 as your parent model and then do not override any of its textures (you specify six new textures instead, which go unused).

You also need to specify a tintindex of 0 for any face in your model that you want colored (look at the vanilla colorable models as examples).

 

Link to post
Share on other sites
8 hours ago, diesieben07 said:

You set the vanilla cake_slice1 as your parent model and then do not override any of its textures

How do I override textures?

Edited by NullDev
Link to post
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.

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