Jump to content

[1.9.4] Prevent Baking Colour in Blocks with an IBlockColor Handler


perry

Recommended Posts

I have a metal that requires a 2 layer effect for the ingot item, the block item, and the block placed in world. On the first layer I have a coloured texture, on the second I have a mask that is multiplied by a sinusoidal function in my IItemColor and IIBlockColor handlers to get a pulsing effect.

 

The items work great in inventory and as entity items dropped into the world but when I place the block it seems the colour is queried once and then baked in. So the block will only update its colour if a block update is called.

 

Here is the block state JSON and model JSON:

 

{
  "forge_marker": 1,
  "defaults": {
    "model": "mod:cube_tinted_overlay",
    "textures": {
      "layer0": "mod:blocks/demongoldblock",
      "layer1": "mod:blocks/blockmask"
    },
    "transform": "forge:default-block"
  },
  "variants": {
    "normal": [{}],
    "inventory": [{}]
  }
}

 

{
  "textures": {
    "particle": "#layer0"
  },
  "elements": [
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "texture": "#layer0", "cullface": "down",  "tintindex": 0 },
        "up":    { "texture": "#layer0", "cullface": "up",    "tintindex": 0 },
        "north": { "texture": "#layer0", "cullface": "north", "tintindex": 0 },
        "south": { "texture": "#layer0", "cullface": "south", "tintindex": 0 },
        "west":  { "texture": "#layer0", "cullface": "west",  "tintindex": 0 },
        "east":  { "texture": "#layer0", "cullface": "east",  "tintindex": 0 }
      }
    },
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "texture": "#layer1", "cullface": "down",  "tintindex": 1 },
        "up":    { "texture": "#layer1", "cullface": "up",    "tintindex": 1 },
        "north": { "texture": "#layer1", "cullface": "north", "tintindex": 1 },
        "south": { "texture": "#layer1", "cullface": "south", "tintindex": 1 },
        "west":  { "texture": "#layer1", "cullface": "west",  "tintindex": 1 },
        "east":  { "texture": "#layer1", "cullface": "east",  "tintindex": 1 }
      }
    }
  ]
}

 

The block is simple, all it does is override canRenderInLayer to true so that it renders in all layers as I need a solid and translucent pass.

 

I'd like to use the same method I do for the items for the block but not sure how to get it to query the colour each frame. Is there a simple solution to this?

 

If not I'll consider using animations for the ingots and blocks but I like freedom I get with the colour multiplier & mask.

 

Cheers

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.