Jump to content

Recommended Posts

Posted

I am really confused and fed up right now....

 

apparently this works:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":Program", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":Program", "inventory"));

 

but this doesn't:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":Empty", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":Lumber", "inventory"));

 

this doesn't either:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":program", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":program", "inventory"));

 

for some reason, this works:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));

 

if you haven't realized already, the only thing changing is the name of the file. I am 100% sure that there is no spelling mistake, and eclipse has been refreshed like 100 times and everything is there. I noticed this in the past too, the texture name can only be the name of the item (in the code).

 

Posted

Casing matters, and first and final warning Jedispencer DO NOT USE UNLOCALIZED NAME like that.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Casing matters

What do you mean by that? Does it have to start with an uppercase/lowercase or does the file have to have the same casing as in the code? (I tried all 3, none of them worked)

Posted

It means that "Hello" is completely different than "hello", as far as Minecraft is concerned.

 

All casing is correct. (Just copy and paste the code into the file name) No dice.

 

I looked in the console to see if it can find the file, and it does. Inside the .json file, it's just a copy and paste of another .json (same textures) the other .json works, this doesn't. ???

Posted

show your assets folder structure please

I am 99% sure that isn't the problem, as it works for other kinds of items, but here it is.

width=150 height=86FBddcTO.png?1 [/img]

Posted

Casing matters, and first and final warning Jedispencer DO NOT USE UNLOCALIZED NAME like that.

It's kind of a shame you edited his post, as now no one else can see what NOT to do.

 

@OP Look in your console for warning / error messages related to the texture path - more often than not, it tells you exactly what it looked for and couldn't find, and you can then go to that folder and see if your texture is there and named exactly the same.

 

As others have said, upper / lower case matters, with the convention being that texture names (and all your .json blockstates, models, etc.) should be ALL lower-case.

Posted

Look in your console for warning / error messages related to the texture path - more often than not, it tells you exactly what it looked for and couldn't find, and you can then go to that folder and see if your texture is there and named exactly the same.

 

As others have said, upper / lower case matters, with the convention being that texture names (and all your .json blockstates, models, etc.) should be ALL lower-case.

 

Console says nothing (it found the file) and I changed everything to lowercase. No texture being shown.

Posted

So if I should use "item.getUnlocalizedName().substring(5)" to get the unlocalized name, then what should I do? Just type in the name myself?

I have no idea - I frequently use getUnlocalizedName just like that to avoid typos and having to edit multiple locations in my code if I ever change a name.

 

@Lex (or anyone else who may know) - what is so egregiously incorrect about using the unlocalized name in place of hard-coding a texture or other name? I, too, am interested in what a better alternative would be, as well as what makes it "wrong".

 

With the paucity of any sort of usage guidelines, we modders are mostly left to come up with our own solutions, many of which may indeed have issues of which we are unaware due to our lack of understanding all of the internal workings of Forge and Minecraft.

 

With that in mind, please help educate instead of simply stating something is wrong.

Posted

getUnlocalizedName is for getting the key for the translation file, nothing else.

Trying to force everyone to use copy paste code just causes confusion of what that method is actually there for.

If you want to use a method to store the item name then there are options, The Block delegate, or you could add a field to your block that holds the name itself, or the plethora of other potential ways of achieving the same thing that doesn't tie the LOCALIZATION STRING to everything else.

 

And basic practice, if your standard operating procedure is to do hard coded string manipulation, then its BAD. String manipulation is SLOW and should be avoided and NOT made your central behavior.

 

'I saw it in a tutorial' is why I'm so adamant about yelling at people. Tutorials are wrong and regurgitating those things just cuz you saw it there is wrong.

 

As for the issue at hand, you should post the full directory listings. Why are you folders outside the 'assets' folder?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

As for the issue at hand, you should post the full directory listings. Why are you folders outside the 'assets' folder?

Sorry, should have cleared this up. Finder shows the folders down-up. Not up-down. The assets folder is outside all the other folders. Like I said, The console gives no error so it has found the file

Posted

Update Forge, I just fixed up some of the error logging with the models/textures.

But that doesn't show me the files themselves.

You should also make sure that when you rename things in your src/ folder you do a clean on your IDE. Eclipse likes to not copy files over simetimes without doing a full build.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Just a recommendation for tiffit, instead of create a new line of code for Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register you should create two methods, one for items and one for blocks. It may look something like:

 

public void registerItemRender(Item item, String location)

{

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0 -- if it has not metadata, new ModelResourceLocation(MODID + ":" + location, "inventory");

}

 

public void registerBlockRender(Block block, String location)

{

    Item item = Item.getItemFromBlock(block);

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0 -- if it has not metadata, new ModelResourceLocation(MODID + ":" + location, "inventory");

}

 

If these aren't correct ways then you could try something else, thats a way I do it since using MODID + ":" + item.getUnlocalizedName().substring(5) is wrong. Also is your file structure like this:

 

src

  main

    java

      resources

        assets

          modid

            blockstates

              name_of_block.json

            lang

            models

              block

                name_of_block.json

              item

                name_of_item.json

            textures

              blocks

                name of block texture in blockstate  .png

              items

                name of item texture in item  .png

 

Long structure but that's how its set-up usually.

Posted

Thanks lex, should I update to the lastest or recommended version (im guessing latest)

Latest is probaby your best guess for modders, recommended for users. Using the latest version assures you you got the latest additions, as you could've guessed :).

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Logs

Code

Screen Shots

If it cant find your models it will log it.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Logs

Code

Screen Shots

If it cant find your models it will log it.

 

Logs:

http://pastebin.com/wAsZBqUN

Don't worry about the wires, thats unrelated.

 

Code:

 

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":empty", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":empty", "inventory"));

 

 

Screenshots:

 

 

Texture is not being drawn:

width=783 height=3867NFoGVT.png?1 [/img]

 

My item model folder:

width=800 height=413tRbH2Fy.png?1 [/img]

 

Its there in eclipse:

width=246 height=544DnmxAHU.png?1 [/img]

 

 

 

I really don't know what more information I can give you.

Posted

Question have you registered Item Variants? The relevant code being

ModelBakery.addVariantName(item,name)

 

I have tried that before, but it didn't work. Let me try again.

Posted

Still doesn't work.

Here is my entire init method

    @EventHandler
    public void init(FMLInitializationEvent event){
    	network.registerMessage(ControlledStrikerPackets.Handler.class, ControlledStrikerPackets.class, 0, Side.SERVER);
    	network.registerMessage(MonsterClonerPackets.Handler.class, MonsterClonerPackets.class, 1, Side.SERVER);
    	network.registerMessage(FillTankPackets.Handler.class, FillTankPackets.class, 2, Side.SERVER);
    	if(event.getSide() == Side.CLIENT){
    		ModelBakery.addVariantName(Program, new String[]{"empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty"});

    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperIngot, 0, new ModelResourceLocation(MODID + ":copperIngot", "inventory"));
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(chargedCopperIngot, 0, new ModelResourceLocation(MODID + ":chargedCopperIngot", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(chargedDust, 0, new ModelResourceLocation(MODID + ":chargedDust", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(chargedDustCluster, 0, new ModelResourceLocation(MODID + ":chargedDustCluster", "inventory"));
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(fireBar, 0, new ModelResourceLocation(MODID + ":fireBar", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(hellBar, 0, new ModelResourceLocation(MODID + ":hellBar", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(demonBar, 0, new ModelResourceLocation(MODID + ":demonBar", "inventory"));

       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 0, new ModelResourceLocation(MODID + ":empty", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Program, 1, new ModelResourceLocation(MODID + ":empty", "inventory"));

       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(Machine), 0, new ModelResourceLocation(MODID + ":Machine", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ControlledStriker), 0, new ModelResourceLocation(MODID + ":ControlledStriker", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(MonsterCloner), 0, new ModelResourceLocation(MODID + ":MonsterCloner", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(Programmer), 0, new ModelResourceLocation(MODID + ":Programmer", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(electricTransformer), 0, new ModelResourceLocation(MODID + ":electricTransformer", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(electricalWireCopper), 0, new ModelResourceLocation(MODID + ":electricalWireCopper", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(electricalWireIron), 0, new ModelResourceLocation(MODID + ":electricalWireIron", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(electricalWireGold), 0, new ModelResourceLocation(MODID + ":electricalWireGold", "inventory"));
       		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(copperBlock), 0, new ModelResourceLocation(MODID + ":copperBlock", "inventory"));
    	
    	}
   		proxy.registerProxies();
    	CraftingRecipe.registerCraftingRecipies();
    	Achievements.registerAchievements();

    }

Posted

You aren't understanding the problem, other things texture just fine. Its just the name that won't work. If I change the name to something else that does work, it works then. So the code is fine. Something else is broken. Ive added the modid, still not being textured

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.