Jump to content

[1.8] [Solved] Texturing is very picky


tiffit

Recommended Posts

EDIT: I have no idea why I thought you were making a Block...

In addition to registering your variants, you also need to make an ItemBlock class, or use ItemMultiTexture from vanilla, that returns the correct damage value for the stack, as well as register each renderer for the correct item damage value:

@Override
public int getMetadata(int damage) {
   return damage;
}

// register each of your variant's resource locations with the correct damage value, assuming they are in an array:
for (int i = 0; i < variants.length; ++i) {
  mesher.register(this, i, new ModelResourceLocation(variants[i], "inventory"));
}

 

I guess in your case, you'd just need to add each damage value for your Programmer registration, as you just have '0'.

 

Btw, when you register a variant, I'm pretty sure you need to fully qualify the name, e.g. "yourmodid:empty".

 

Also, I'm sure someone mentioned it before, but you should use your proxy for registering the model resource locations and variants.

Link to comment
Share on other sites

ok, ok. ill try all your examples. Someone tell me why THIS works then.

 

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));

Link to comment
Share on other sites

When minecraft starts, in preInit() you need to tell it to load all model files. If there is one item or one block - it will do it automatically. When block or item has variants - you need to tell it that "hey, also load this model.json". Then in init() you need to tell MC to assign registered and  baked models to item and itemMeta.

 

Why it does work: You are using same texture (same model) for both metadata variants of item. This model is registered. What you do is only assign model to its meta item. When it will stop working: if you make 2 models for 2 different meta, only one will work or neither if variant changes unlocalized name of item (which is possible).

 

EDIT Fixed lot of typos (I just woke up).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

ok ok. I see your logic. But why then, does this not work?

 

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(demonBar, 0, new ModelResourceLocation(MODID + ":empty", "inventory"));

 

demonBar only has 1 variant, but the "empty" model isn't showing. Why?

 

 

Also, good morning :)

Link to comment
Share on other sites

MC will only bake default models. If "empty" is something that is NEVER registered, it's not baked (in preInit) - thus you cannot assign it to anything (in init).

 

If I'd have to debug it you would need to post your proxies, all json files and block/item initialization.

Post src on Git - you will get direct help much faster.

 

Seriously man - just go to MCByExample - EVERYTHING is there if you follow it VERY thorough. There is nothing left to say.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

If your 'empty' model isn't showing no matter where you try it, then the problem must be either with the model or the texture, and my bet is on the model.

 

I've copied and pasted plenty of models, and about half the time I ended up with texture issues like this because I forgot to add or remove 's' from 'block' or 'item' in the texture or model name, i.e. models are in 'block' or 'item', but textures are in 'blocks' or 'items'.

 

The point is, just because you copied and pasted it, doesn't mean there isn't a problem. Post your empty.json model contents.

 

EDIT: Actually, I think Ernio has the right of it, as if you messed up on the naming, you should have gotten an error message in the console which you clearly didn't. Oh well.

Link to comment
Share on other sites

A working model:

{
    "parent": "tiffitmachines:builtin/generated",
    "textures": {
        "layer0": "tiffitmachines:items/fireBar"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

 

empty.json:

{
    "parent": "tiffitmachines:builtin/generated",
    "textures": {
        "layer0": "tiffitmachines:items/fireBar"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

I have everything like the minecraft by example. My model bakery is in preInit.

 

 

Are you guys stumped? Cause I definitely am.

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.