Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10] Blockstates and Item Models
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Draco18s

[1.10] Blockstates and Item Models

By Draco18s, November 26, 2016 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted November 26, 2016

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?

  • Quote

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.

Share this post


Link to post
Share on other sites

Choonster    1651

Choonster

Choonster    1651

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1651
  • 5100 posts
Posted November 26, 2016

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

).

  • Quote

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.

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted November 27, 2016

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"
    }
}

  • Quote

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.

Share this post


Link to post
Share on other sites

Choonster    1651

Choonster

Choonster    1651

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1651
  • 5100 posts
Posted November 27, 2016

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

  • Quote

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.

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted November 27, 2016

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.

  • Quote

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.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • cadbane86140
      Minecraft: Parkour Stairs Part 1!

      By cadbane86140 · Posted 32 minutes ago

      Hello There! Today we are playing a BRAND NEW parkour map that was actually just released about a month ago and all I gotta say is that this map is so freaking unique and the map creators did something with this map that we have never seen in parkour before! There are so many hilarious moments in this video that I know you guys are gonna love! I hope you all enjoy this video and if you did don't forget to like and sub for more! https://www.youtube.com/watch?v=5aGkMp5bExg
    • cadbane86140
      Revisiting our 2013 head shop!

      By cadbane86140 · Posted 33 minutes ago

      Hello there! With the recent re release of the old creative server I knew I had to make a video on there. So that is exactly what we did! We did a small tour of our old plot like we did last time but however we remembered some of our old friends and we checked out their old plots too! If you guys want us to do more where we just travel to different plots and talk about them let me know! But I hope you all enjoy this video and if you did don’t forget to like and sub for more videos Like this in the future! https://youtu.be/_m_lViaMlGU
    • kiou.23
      Block Rotate

      By kiou.23 · Posted 1 hour ago

      That's usually the case, always try to understand the code before copy and pasting, or else you'll get a lot of headaches later in the code's life
    • Varzac
      Forge jar file not opening

      By Varzac · Posted 1 hour ago

      I ran Jarfix and then tried installing again with the same results. Nothing happening I even tried using winrar, but as you said nothing happened
    • BeardlessBrady
      [1.16.4] Null when OpenGUI

      By BeardlessBrady · Posted 1 hour ago

      Ah.. Thats what I get for stopping half way through and not double checking, thanks!
  • Topics

    • cadbane86140
      0
      Minecraft: Parkour Stairs Part 1!

      By cadbane86140
      Started 32 minutes ago

    • cadbane86140
      0
      Revisiting our 2013 head shop!

      By cadbane86140
      Started 33 minutes ago

    • ehbean
      10
      Block Rotate

      By ehbean
      Started 7 hours ago

    • Varzac
      3
      Forge jar file not opening

      By Varzac
      Started 13 hours ago

    • BeardlessBrady
      2
      [1.16.4] Null when OpenGUI

      By BeardlessBrady
      Started 2 hours ago

  • Who's Online (See full list)

    • Beethoven92
    • ThisIsNotOriginal
    • Sqsuensay
    • HappyAndJust
    • Funyaah
    • ehbean
    • kiou.23
    • -MCS_Gaming-
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10] Blockstates and Item Models
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community