Jump to content

Block with blockstates don't render as item models


kitsushadow

Recommended Posts

For everything.

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.

Link to comment
Share on other sites

So i registered renders for the different subtypes and it picked up on when the meta is 0 but i still see no item in the creative tab for the other subtype. I feel like i haven't registered the subTypes of the itemBlock. This is the new rendering method i used.

public class ModBlocks {

    public static Block firebox;
    public static Block bloomery;
    public static Block pistonbellowsoak;
    public static Block pistonbellowsjungle;
    public static Block pistonbellowsbirch;
    public static Block pistonbellowsspruce;
    public static Block pistonbellowsdarkoak;
    public static Block pistonbellowsacacia;
    public static Block emptycrucible;
    public static Block emptycruciblehot;
    public static Block emptycruciblecracked;
    public static Block emptycruciblecrackedhot;

    public static Block rawironcrucible;
    public static Block hotironcrucible;
    public static Block hotcookedironcrucible;
    public static Block coolironcrucible;
    public static Block failedironcrucible;
    public static Block failedironcruciblehot;

    public static Block ironball;
    public static ItemBlock ironballitem;


    public static void init() {

        firebox = new Forge(Material.ROCK);

        bloomery = new Bloomery(Material.ROCK, "bloomery");

        pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
        pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
        pistonbellowsbirch = new PistonBellows(Material.WOOD, "pistonbellowsbirch");
        pistonbellowsspruce = new PistonBellows(Material.WOOD, "pistonbellowsspruce");
        pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
        pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia");

        emptycrucible = new Crucible(Material.ROCK, "emptycrucible");
        emptycruciblehot = new CrucibleHot(Material.ROCK, "emptycruciblehot");
        emptycruciblecracked = new Crucible(Material.ROCK, "emptycruciblecracked");
        emptycruciblecrackedhot = new CrucibleHot(Material.ROCK, "emptycruciblecrackedhot");

        rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible");
        hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
        hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
        coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
        failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
        failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");

        ironball = new IngotBall(Material.IRON, "ironball", 5.0F);
        ironballitem = new ItemBlockIngotBall(ironball);

    }

    public static void register() {
        registerBlock(firebox);
        registerBlock(bloomery);

        registerBlock(pistonbellowsoak);
        registerBlock(pistonbellowsjungle);
        registerBlock(pistonbellowsbirch);
        registerBlock(pistonbellowsspruce);
        registerBlock(pistonbellowsdarkoak);
        registerBlock(pistonbellowsacacia);

        registerBlock(emptycrucible);
        registerBlock(emptycruciblehot);
        registerBlock(emptycruciblecracked);
        registerBlock(emptycruciblecrackedhot);

        registerBlock(rawironcrucible);
        registerBlock(hotironcrucible);
        registerBlock(hotcookedironcrucible);
        registerBlock(coolironcrucible);
        registerBlock(failedironcrucible);
        registerBlock(failedironcruciblehot);

        registerBlockSubType(ironball, ironballitem);
    }

    public static void registerRenders() {
        registerRender(firebox);
        registerRender(pistonbellowsoak);
        registerRender(pistonbellowsjungle);
        registerRender(pistonbellowsbirch);
        registerRender(pistonbellowsspruce);
        registerRender(pistonbellowsdarkoak);
        registerRender(pistonbellowsacacia);
        registerRender(bloomery);
        registerRender(emptycrucible);
        registerRender(emptycruciblehot);
        registerRender(emptycruciblecracked);
        registerRender(emptycruciblecrackedhot);

        registerRender(rawironcrucible);
        registerRender(hotironcrucible);
        registerRender(hotcookedironcrucible);
        registerRender(coolironcrucible);
        registerRender(failedironcrucible);
        registerRender(failedironcruciblehot);

        registerRender(ironball);
        registerRenderCustom(ironballitem, 0, new ModelResourceLocation(ironballitem.getUnlocalizedName() + "_0"));
        registerRenderCustom(ironballitem, 1, new ModelResourceLocation(ironballitem.getUnlocalizedName() + "_1"));

    }

    private static void registerBlock(Block block) {
        GameRegistry.register(block);
        ItemBlock item = new ItemBlock(block);
        item.setRegistryName(block.getRegistryName());
        GameRegistry.register(item);
    }

    private static void registerBlockSubType(Block block, ItemBlock itemBlock){
        GameRegistry.register(block);
        ItemBlock item = itemBlock;
        item.setRegistryName(block.getRegistryName());
        GameRegistry.register(item);
    }

    private static void registerRender(Block block) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
    }

    private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model){
        ModelLoader.setCustomModelResourceLocation(item, meta, model);
    }

}
Link to comment
Share on other sites

So, a couple things.

 

1) You can't register the renderer in common code.

2) If a subtype isn't showing up in the creative menu, that's because you haven't overriden getSubItemsin your Item class.

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.

Link to comment
Share on other sites

19 minutes ago, Draco18s said:

So, a couple things.

 

1) You can't register the renderer in common code.

2) If a subtype isn't showing up in the creative menu, that's because you haven't overriden getSubItemsin your Item class.


I'm not registering the rendering in common code.

What do I override getSubItems with?

I'm asking so many questions cuz i really dont have a good example to study and figure it out from. Sorry

Edited by kitsushadow
Link to comment
Share on other sites

Yes....  I'm asking what the contents of the method should be. Or am i not adding anything to the method?

 

I say that because I overrode the method in the ItemBlock class but nothing changed. I remember vaguely about needing to make an Enum with the subTypes in it or something. I can't remember. 

 

And i still don't feel like the itemSubtypes are being registered.

Edited by kitsushadow
Link to comment
Share on other sites

Seriously, what?

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/item/ItemRawOre.java#L52

Fuck.

Quote

I'm not registering the rendering in common code.

Yes you are.

You have Minecraft.getMinecraft() in your ModBlocks class and it's not marked Side Only: Client. Your ModBlocks class is common code. Therefor you have client-only code in a common location. THIS WILL CRASH THE DEDICATED SERVER.  Don't believe me? Hit the little  ▼ next to the Run button and click "Server"

 

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.

Link to comment
Share on other sites

He's frustrated i dont understand the basics of the Forge Framework... I'm actually pretty frustrated myself with it. Tons of not so great tutorials and it kinda lands you right where we are now. Regardless, yes ur right at @Draco18s i setup a ServerStart and it did crash exactly how u said it would.

Thanks for the source code example, that makes our lives a little easier.

Link to comment
Share on other sites

13 minutes ago, kitsushadow said:

He's frustrated i dont understand the basics of the Forge Framework...

More like the basics of Java.  Method overriding isn't that hard, looking at examples in vanilla isn't that hard either, and intuiting what the method should do based on the parameter names, return type, and javadoc isn't super complicated.

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.

Link to comment
Share on other sites

1 minute ago, Draco18s said:

More like the basics of Java.  Method overriding isn't that hard, looking at examples in vanilla isn't that hard either, and intuiting what the method should do based on the parameter names, return type, and javadoc isn't super complicated.

Shit, I know how to override a fkng method. My previous question wasn't about the method override it was about the content of the override.
Thanks for the help thus far mate, I know it's like pulling teeth dealing with some people but you should consider that the feeling is mutual. I stay patient and ask the simple stupid questions to progress the resolution of the issue. Please share the same patience as those whose whom your helping.


 

Link to comment
Share on other sites

Having to repeatedly ask everybody the same stupid question is why I don't have any patience.  There's a reason the "Frequently Asked Questions" thread is actually called the "Excessively Asked Questions" thread.

 

Asking "I overrode the method, but didn't put anything in it, nothing changed" is pretty freaking dumb.  Of course nothing changed, the default behavior is an empty method.  Right click -> Find all references.

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.

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.