Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.