Jump to content

Recommended Posts

Posted

I've kind of been ignoring this one for a while because there's nothing technically wrong, just that the display is not as would be desired.

 

I have a block with multiple states that uses a blockstate file to define which texture should display.

The block model is blocks/cross (flowers, tall grass, etc)

 

However this means that the item model is likewise displayed as a cross block:

width=800 height=449https://s14.postimg.org/5skgv4dtt/2016_11_26_13_09_32.png[/img]

 

Is there a way to specify a separate item model, but still use the blockstate file for the specific texture?

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.

Posted

You'd need to have a property to determine the model that's

true

for items and

false

for blocks. Completely ignore it in your

Block

so it defaults to

false

, but set it to

true

for the variant of your

Item

's

ModelResourceLocation

.

 

You then need to create a model that extends

item/generated

(or the appropriate item model) and put it somewhere in

assets/<modid>/models/block

so it's accessible from your blockstates file. When the property is

true

, use this model; else use

block/cross

.

 

You'll also need to set the

layer0

texture to

#cross

in your

defaults

section (i.e. use the

cross

texture as

layer0

).

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.

Posted

That....half worked.

 

The item model is 100% spot on, but the block model is broken.

Edit: nope, it was me derping with my custom state mapper.  The

getModelResourceLocation()

method was not 100% flexible. It only returned the resource location for a single property, rather than for all properties (except the one it was meant to "ignore").

 

I still have this though, but it shows up perfectly anyway:

 

[19:06:56] [Client thread/WARN]: Unable to resolve texture due to upward reference: #cross in oreflowers:models/block/item/flower

 

Blockstate:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
        },
        "model": "oreflowers:flower",
        "uvlock": true
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
         "flower_type": {
            "poorjoe":      { "textures": { "cross": "oreflowers:items/poorjoe"} },
            "horsetail":    { "textures": { "cross": "oreflowers:items/horsetail"} },
            "vallozia":     { "textures": { "cross": "oreflowers:items/vallozia"} },
            "flame_lily":   { "textures": { "cross": "oreflowers:items/flame_lily"} },
            "tansy":        { "textures": { "cross": "oreflowers:items/tansy"} },
            "hauman":       { "textures": { "cross": "oreflowers:items/hauman"} },
            "leadplant":    { "textures": { "cross": "oreflowers:items/leadplant"} },
            "red_amaranth": { "textures": { "cross": "oreflowers:items/red_amaranth"} }
        },
        "item":{
            "true":{
                "model": "oreflowers:item/flower"
            },
            "false":{}
        }
    }
}

 

Item model:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "#cross",
        "cross": "oreflowers:items/poorjoe"
    }
}

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.

Posted

[19:06:56] [Client thread/WARN]: Unable to resolve texture due to upward reference: #cross in oreflowers:models/block/item/flower

Don't set

layer0

to

#cross

in the model, do it in the blockstates file. Textures in models can't reference a texture defined in the same model.

 

[19:06:57] [Client thread/ERROR] [FML]: Exception loading model for variant oreflowers:oreflowers1#flower_type=leadplant for blockstates ["oreflowers:oreflowers1[flower_stalk=false,flower_type=leadplant,item=true]", "oreflowers:oreflowers1[flower_stalk=false,flower_type=leadplant,item=false]"]

Your blockstates file doesn't include the

flower_stalk

property. Edit: I see you've fixed this.

 

I've created a sapling that uses the vanilla variants and defines the item models using Forge's blockstates format. You can see it for 1.10.2 here or 1.11 here (there's no difference in the sapling code, but each of these links is for a separate branch of the repository with code for that version).

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.

Posted

Your blockstates file doesn't include the

flower_stalk

property. Edit: I see you've fixed this.

 

What was actually happening (as the stalk property actually changes files) was that it was trying to find [flower_type] within [flower_type,item] due to my bungling of getModelResourceLocation()

 

I've created a sapling that uses the vanilla variants and defines the item models using Forge's blockstates format. You can see it for 1.10.2 here or 1.11 here (there's no difference in the sapling code, but each of these links is for a separate branch of the repository with code for that version).

 

Thanks for the examples.

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.

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.