Jump to content

Recommended Posts

Posted (edited)

I have a block which is rendered as ENTITYBLOCK_ANIMATED like a chest. The block is rendering in the world as expected, but there are two problems:

1. [Solved with custom IStateMapper] I get this console error, because it's looking for a blockstates json, even though it doesn't need one because it doesn't need a block model at all. 

  Reveal hidden contents

2. [Solved, I was just forgetting to register the item model at all] The itemblock is rendering with the missing model texture in the inventory, even though I have an item model json (and there's no corresponding console error). My item model is at models/item/block_box.json:

  Reveal hidden contents

 

Edited by Jay Avery
Posted
  On 2/23/2017 at 3:23 PM, Jay Avery said:

I have a block which is rendered as ENTITYBLOCK_ANIMATED like a chest. The block is rendering in the world as expected, but there are two problems:

1. I get this console error, because it's looking for a blockstates json, even though it doesn't need one because it doesn't need a block model at all. 

  Reveal hidden contents
Expand  

 

You can fix this by registering an IStateMapper that returns an empty Map.

 

 

  22 minutes ago, Jay Avery said:

2. The itemblock is rendering with the missing model texture in the inventory, even though I have an item model json (and there's no corresponding console error). My item model is at models/item/block_box.json:

  Reveal hidden contents

 

Expand  

 

I'm not too sure about this.

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 (edited)
  On 2/23/2017 at 3:53 PM, Choonster said:

 

You can fix this by registering an IStateMapper that returns an empty Map.

Expand  

Thanks - do you know of a tutorial or example for using IStateMapper?

 

Edit: nevermind, I figured it out! This has removed the console error of problem #1, but the item is still not working.

 

Edit again: turns out I had just made a mistake and wasn't registering the item model at all, so that's fixed #2, oop.

Edited by Jay Avery
Posted
  On 2/23/2017 at 4:03 PM, Jay Avery said:

Thanks - do you know of a tutorial or example for using IStateMapper?

Expand  

 

It's an interface with a single method, implement it to return Collections#emptyMap. There's no need for a tutorial or example.

 

Register it by calling ModelLoader#setCustomStateMapper on the client side in ModelRegistryEvent (if you're registering your Blocks/Items in RegistryEvent.Register) or preInit (if you're registering them in preInit).

  • Like 1

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.

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.