Jump to content

[1.10] Coloring only one texture layer in a Block's json


JigenEagle

Recommended Posts

Hello,

 

I am currently trying to implement a custom 'Material' (as in Iron/Gold/etc) pipeline in my mod. To do so I am generating ores, ingots, etc. using a single base texture and a material's assigned color. I understand how to achieve desired results for coloring Items and single-layer blocks, but I am having trouble figuring out how the following can be done:

 

7ajyZdK.png

 

I have two texture files, the stone, and the white ore vein overlay.

The block would have the base layer of stone.

The overlay layer would be the ore veins post-colored.

 

Are there any classes currently in MC/MCForge that I can utilize to Color just one layer of a block's texture?

How would I go about this, or at least how could I refine my search to find information on achieving this result?

 

Once this is figured out will treating the block as any other, like creating an ItemBlock, retain the desired appearance in the player's inventory? Or will additional work be required?

Link to comment
Share on other sites

The

block/grass

model already does something like this: It has one full cube with only the top coloured and another cube without a top or bottom and each side coloured. The cubes are the same size, but the second cube's texture is overlayed on the first.

 

What you need is a cube with the stone texture on all sides and another cube with the ore texture on all sides and each side coloured.

 

For a face to be coloured, specify the tint index in the model and then register an

IBlockColour

and

IItemColour

for the

Block

and

ItemBlock

. These will receive the tint index as an argument, telling them which part of the model is being coloured (though you don't need to worry about that if the model only has a single dynamic colour).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

(though you don't need to worry about that if the model only has a single dynamic colour).

 

His example has two: the ore color (blue) and the stone color (white).

 

In any case, if the OP wishes to go the custom TextureAtlasSprite route (which renders the color once) I've got some posts on this forum on how to do precisely that.  I don't know if the class has changed in 1.8+ however, and due to the nature of a custom

load()

method in that class, a lot of the "texture not found" error messages get dropped (and instead you get NPEs in later parts of the rendering code), so you'd be mostly on your own.

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.

Link to comment
Share on other sites

(though you don't need to worry about that if the model only has a single dynamic colour).

 

His example has two: the ore color (blue) and the stone color (white).

 

The stone isn't dynamically coloured, it would just be a regular texture.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

In this case I will be opting with the tintIndex route. It seems like the easier of the two to first approach, and colors may have to change dynamically.

And yes, the backdrop of the ore itself referenced in Step 2 is a static texture, no color need be applied.

 

In saying that, would this be the correct way of setting up my JSON file for the ore block?

'ore' is just a stone backdrop and 'ore_vein' is the white vein to be tinted.

 

(I am away from my testing environment and am just clearing roadblocks I foresee when I begin work.)

 

{   "parent": "block/block",
    "elements": [
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore",   "cullface": "east" }
            }
        },
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "fi:blocks/ore_vein", "tintindex": 0, "cullface": "east" }
            }
        }
    ]
}

Link to comment
Share on other sites

That looks correct, though I'd recommend using texture references like

#ore

and

#ore_vein

in the base model instead of texture paths. You can then specify the actual paths of these references in the derived models or blockstates file (if you're using Forge's blockstates format).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I am indeed using Forge blockstates.

I set up some basic debug blocks and items to test and ran into an error-less roadblock.

 

I did not pass a tintIndex when registering, I got the following result:

 

yVbhRl1.png

 

It shows up fine in my inventory, however the block in the real world is incorrect as shown.

Is there something I am missing to correctly render the block in the world?

 

Here are my JSONs, both named 'oreDebug'

 

model

{   "parent": "block/block",
    "elements": [
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#base",   "cullface": "east" }
            }
        },
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" }
            }
        }
    ]
}

 

 

blockstate

{
    "forge_marker": 1,
    "defaults": {
        "uvlock": true
    },
    "variants": {
        "normal": [{ 
            "textures": {
                "base": "fenton:blocks/ore",
                "overlay": "fenton:blocks/ore_vein"
            },
            "model": "fenton:oreDebug" 
        }],
        "inventory": [{ 
            "textures": {
                "base": "fenton:blocks/ore",
                "overlay": "fenton:blocks/ore_vein"
            },
            "model": "fenton:oreDebug" 
        }]
    }
}

Link to comment
Share on other sites

You'll also need to override

Block#getBlockLayer

to return

BlockRenderLayer.CUTOUT

or

BlockRenderLayer.CUTOUT_MIPPED

(

BlockGrass

uses the latter). This allows the block's textures to render with transparency.

 

The Grey Ghost explains render layers in more detail here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

  • 3 months later...

Hello,

 

Sorry to bump this thread but this is exactly what I'm trying to do as well. I have a block with 2 models (one for the base block with a basic texture, and another one for drawing a transparent texture with CUTOUT render) and I'm trying to find a way to apply a specific color on the transparent texture. I've searched in multiple places but I don't see how to achieve this.

 

Maybe the OP has found how to do it, idk, this is why I use this thread to ask.

 

Thanks.

Link to comment
Share on other sites

Hello,

 

Sorry to bump this thread but this is exactly what I'm trying to do as well. I have a block with 2 models (one for the base block with a basic texture, and another one for drawing a transparent texture with CUTOUT render) and I'm trying to find a way to apply a specific color on the transparent texture. I've searched in multiple places but I don't see how to achieve this.

 

Maybe the OP has found how to do it, idk, this is why I use this thread to ask.

 

Thanks.

 

I already told the OP how to do this and the OP posted a model that worked apart from the render layer (which I told them how to fix). Did you read the thread?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I did, I have a working model, everything is fine on this side. I'm just looking how to apply a color on a specific layer and I can't figure out how tintindex works here.

 

In my case I have a block with a painted line on it. The line is on a separate layer (like OP did for the ore vein):

 

(stupid imgur blocking hotlinking...)

 

And I would like to know how to taint it with another color so I don't need to make different textures for every color (even if for now I only have white and yellow lines planned). I've looked for many threads on many forums, read many docs, but still can't see how that would work (if that can be done).

 

Edit: I'm in 1.9.4 but 1.10.2 is fine too.

Link to comment
Share on other sites

If you want to change the color, change the value in your

IItemColor

/

IBlockColor

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So i know for a fact this has been asked before but Render stuff troubles me a little and i didnt find any answer for recent version. I have a custom nausea effect. Currently i add both my nausea effect and the vanilla one for the effect. But the problem is that when I open the inventory, both are listed, while I'd only want mine to show up (both in the inv and on the GUI)   I've arrived to the GameRender (on joined/net/minecraft/client) and also found shaders on client-extra/assets/minecraft/shaders/post and client-extra/assets/minecraft/shaders/program but I'm lost. I understand that its like a regular screen, where I'd render stuff "over" the game depending on data on the server, but If someone could point to the right client and server classes that i can read to see how i can manage this or any tip would be apreciated
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
  • Topics

×
×
  • Create New...

Important Information

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