Jump to content

Recommended Posts

Posted

I am new to modding and could really use some help.  I have been trying to get my custom chair block to render and cannot figure this out.  It renders my chair with texture in my inventory, in my hand, and spins on the ground if I drop it...but I keep getting the purple/black block if I place it on the ground.

 

Here is what I have:

Console output

https://pastebin.com/034k0vY9

Blockstate.json

https://pastebin.com/ywF79D1P

Block.json

https://pastebin.com/xMhs4Vpe

Item.json

https://pastebin.com/0P2MBUjF

Posted

Okay I see that #normal in the consle...but what needs to be done to fix it?

[12:19:19] [Client thread/ERROR] [FML]: Exception loading model for variant stevemod:blockoakchair#normal for blockstate "stevemod:blockoakchair"

 

 I thought "normal" was only specified in the blockstate if you only have 1 variant.  I tried adding "normal": to my blockstate and it didn't do anything.

{
    "variants": {
            "facing=up": { "model": "stevemod:blockoakchair" },
            "facing=east": { "model": "stevemod:blockoakchair" },
            "facing=south": { "model": "stevemod:blockoakchair", "y": 90 },
            "facing=west": { "model": "stevemod:blockoakchair", "y": 180 },
            "facing=north": { "model": "stevemod:blockoakchair", "y": 270 } 
    }
}

 

Posted

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

I appreciate the help everyone.  I'm determined to learn this stuff regardless of how upside down my brain is right now.

Here is the rest of my code:

ModBlocks.java

https://pastebin.com/iw77ifVf

 

blockOakChair.java

https://pastebin.com/eYZ75eY1

 

 

1 hour ago, Draco18s said:

Draco18s...So it looks like you state your whole block into your blockstate?  Do you even have a block.json?

Posted
9 minutes ago, modblockminer said:

Draco18s...So it looks like you state your whole block into your blockstate?  Do you even have a block.json?

Uh what do you mean "my whole block"?

Of course I have a model:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/resources/assets/harderores/models/block/axel.json

Two for this block, actually:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/resources/assets/harderores/models/block/frame.json

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

Forgive me if I'm speaking jibberish...still learning.

Ah okay...of course. Was a bit confused when I first saw your blockstate and it looks much different than mine.  I can see you still need the block.json to specify your cubes to design your block.

I will try and tweak mine a bit based on your example and see what happens.

 

6 hours ago, diesieben07 said:

As you can see in the console it is trying to load the "normal" variant from your blockstate, but that variant does not exist there.,

I guess I am confused as to where/why "normal" is defined and trying to load from the blockstate.

 

I was doing pretty good with the modding basics of items/blocks/recipes until I decided to try a custom block.  Kicking my butt.

Posted
2 minutes ago, modblockminer said:

I guess I am confused as to where/why "normal" is defined and trying to load from the blockstate.

 

I was doing pretty good with the modding basics of items/blocks/recipes until I decided to try a custom block.  Kicking my butt.

Its from when you register a model for your item. You are doing that, yes?

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
7 minutes ago, Draco18s said:

Its from when you register a model for your item. You are doing that, yes?

As in register here?

public class ModBlocks {

    public static Block rubyblock;
    public static Block oakchair;
        
    public static void init() {
        rubyblock = new blockRuby();
        oakchair = new blockOakChair();
    }
    
    public static void register() {
        registerBlock(rubyblock);
        registerBlock(oakchair);
    }
    
    private static void registerBlock(Block block) {
        GameRegistry.register(rubyblock);
        GameRegistry.register(oakchair);
        ItemBlock item = new ItemBlock(block);
        item.setRegistryName(block.getRegistryName());
        GameRegistry.register(item);        
    }
    

    public static void registerRenders() {
        registerRender(rubyblock);
        registerRender(oakchair);
    }
    
    private static void registerRender(Block block) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
        block.setCreativeTab(Main.tabblocks);
    }

Posted

If you want your block to have a variable state (like direction), you need to use blockstates. Define a property, override getMetaFromState and getStateFromMeta, and whatever methods you need to set the state as you want it (e.g. getStateForPlacement).

 

If you don't want to do this, instead you can simplify your blockstates file - remove the "facing" variants and just provide a "normal" variant and the model will always be facing the same direction.

Posted
Quote

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

Aw for fuck's sake.

Use ModelLoader.setCustomModelResourceLocation, stop using old, out of date methods that are broken and don't work properly.

  • Like 1

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

The mesher is a tricky method called during init. Used by vanilla but now discouraged for mods, it's tricky because certain things need to be called in a certain order (and the client side-only proxy is involved, which separates some of those statements in code space). I  believe that Forge created the custom location method because it's much less fragile.

 

Note that it's called during preInit, not init.

 

The threads discouraging mesher use run like a rash across this forum going back almost 2 years. Any modder facing any rendering problems should have come across them when searching for answers to avoid posting repeat questions. That's why Draco sounds frustrated: When someone shows up here using the mesher call, it means that the modder's scholarship stopped at a long obsolete tutorial without reading any threads written in the last 22 months.

  • Like 4

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
On 5/15/2017 at 5:33 AM, Draco18s said:

Aw for fuck's sake.

Use ModelLoader.setCustomModelResourceLocation, stop using old, out of date methods that are broken and don't work properly.

Draco18s might have anger management issues...I don't care.  If it's crap...please tell me.  If I don't have the proper methods...it's simply because I didn't know.  That's why I came to the forums.

I'm new to all of this and trying to learn.  I probably should have learned some java to start, but that would have been mind numbing and I would have quit.  I enjoy MC and figured modding would keep my interest and learn some coding.

 

19 hours ago, jeffryfisher said:

The threads discouraging mesher use run like a rash across this forum going back almost 2 years. Any modder facing any rendering problems should have come across them when searching for answers to avoid posting repeat questions. That's why Draco sounds frustrated: When someone shows up here using the mesher call, it means that the modder's scholarship stopped at a long obsolete tutorial without reading any threads written in the last 22 months.

Yes, jeffryfisher...I started with 3 different video/written tutorials trying to learn the basics...so it sounds like I was taught incorrectly.  From your suggestion, I will get better info from the forums. Thank you.

 

On 5/14/2017 at 11:52 PM, Jay Avery said:

If you want your block to have a variable state (like direction), you need to use blockstates. Define a property, override getMetaFromState and getStateFromMeta, and whatever methods you need to set the state as you want it (e.g. getStateForPlacement).

 

If you don't want to do this, instead you can simplify your blockstates file - remove the "facing" variants and just provide a "normal" variant and the model will always be facing the same direction.

Jay Avery...I was able to successfully render a basic ore block using my own texture.  My next step was design my own block.  I created a chair which had several cube elements all using the same texture.  So yes, my blockstate has facing variants.

 

I'm still trying to figure out from the console error [ [FML]: Exception loading model for variant stevemod:blockoakchair#normal ] is the issue with my blockstate or somewhere else in the code.  I guess I don't understand why it's looking for a #normal variant when I'm not using it.

Posted (edited)
4 minutes ago, modblockminer said:

Jay Avery...I was able to successfully render a basic ore block using my own texture.  My next step was design my own block.  I created a chair which had several cube elements all using the same texture.  So yes, my blockstate has facing variants.

 

I'm still trying to figure out from the console error [ [FML]: Exception loading model for variant stevemod:blockoakchair#normal ] is the issue with my blockstate or somewhere else in the code.  I guess I don't understand why it's looking for a #normal variant when I'm not using it.

Your block class doesn't contain a facing property though. You have to define it in the block's code, otherwise how does minecraft know when to use which variants from the blockstate file? When you don't specify variants, it uses "normal" by default. The link I sent explains how to create a block property.

Edited by Jay Avery
  • Like 1
Posted
5 hours ago, modblockminer said:

Yes, jeffryfisher...I started with 3 different video/written tutorials trying to learn the basics...so it sounds like I was taught incorrectly.  From your suggestion, I will get better info from the forums. Thank you

On 4/6/2017 at 3:18 PM, Draco18s said:

the tutorial you were using is old and shitty.

 

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 (edited)

Okay...here is where I am at.

On 5/15/2017 at 5:33 AM, Draco18s said:

Aw for fuck's sake.

Use ModelLoader.setCustomModelResourceLocation, stop using old, out of date methods that are broken and don't work properly.

1.  I have a working ModelLoader.setCustomModelResourceLocation method.

2.  My custom block now renders on the ground and faces correctly, BUT...it is now invisible in my inventory where is was visible before.

 

Any suggestions?

Edited by modblockminer
Posted
38 minutes ago, modblockminer said:

Okay...here is where I am at.

1.  I have a working ModelLoader.setCustomModelResourceLocation method.

2.  My custom block now renders on the ground and faces correctly, BUT...it is now invisible in my inventory where is was visible before.

 

Any suggestions?

 

When are you calling ModelLoader.setCustomModelResourceLocation? It needs to be called before init, otherwise it won't do anything.

 

If you register your Items (including ItemBlocks) in RegistryEvent.Register<Item> (the new and recommended way), register the models in ModelRegistryEvent. If you register them in preInit (the old way), register the models in preInit as well.

 

The FML log will usually have an error message telling you why a particular model wasn't loaded. If you don't know how to interpret the errors, post the full log using Gist.

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

Thank you to everyone that pitched in.  I got it working thanks to all your suggestions.  It's probably a bit messy,...but its working.  Thank you, thank you, thank you.

 

Now onto the next challenge...whatever that may be.

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.