Jump to content

[SOLVED] [1.12.2] Can't figure out how items/blocks's textures works...


Recommended Posts

Posted

Heyyy! I'm Lotte, I'm French so my English won't be perfect. I've always wanted to make a mod, and I'm a huuuge newbie with Java and anything about programming since I pretty much just got throw into it... ;~;

So I followed few tutorials on YouTube and got it all right! My mod appeared and everything, I've tried to add two items and they both appears as well.

 

Tho, little problem... they both doesn't have any texture, instead of that, they got replaced by that old glitchy purple-black squares with modid:itemname#inventory ("lottycraft:copper_ingot#inventory" in my case) written on it in cyan. So I checked my JSON files few times and... I don't see any problem so far from what I've seen on Google. :c

The names matches with the 16x16 PNG files, same goes with the modid and everything.

 

Here is my References Class from com.lotty.lottycraft.utils:

{
    public static final String MOD_ID = "lottycraft";
    public static final String NAME = "LottyCraft";
    public static final String VERSION = "1.0";
    public static final String ACCEPTED_VERSION = "[1.12.2]";

    public static final String CLIENT_PROXY_CLASS = "com.lotty.lottycraft.proxy.ClientProxy";
    public static final String COMMON_PROXY_CLASS = "com.lotty.lottycraft.proxy.CommonProxy";
}

 

And here is one of my JSON file from ressources.assets.lottycraft.models.item:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "lottycraft:items/copper_ingot"
  }
}

 

About my PNG files, I've placed them into ressources.assets.lottycraft.textures.items, and of course, I named one of them "copper_ingot".

I also made the ressources.assets.lottycraft.lang files, but I guess it doesn't have anything to deal with those.

 

If anyone could help me, it would be very very sweet of you! Just keep in mind I baaarely understands how things works in that world yet, so don't use too difficult stuff please... ^~^
An early thanks! And in any case, here's my Discord: LewdyLoli#5257 (...don't worry about the name.)

Posted
2 minutes ago, Lotte said:

that old glitchy purple-black squares

That is an intentional texture choice designed to stand out as THIS IS WRONG, FIX IT so that things that are broken don't go into production. Magenta/black checkerboard is a pretty standard missing texture texture these days, dating back to Counter Strike: Source.

 

Anyway, you're going to need to include more of your code, namely where you register your item models. Post a working github repo as the best way to provide us with all of the necessary code and resources.

  • Thanks 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
53 minutes ago, Lotte said:

There you go, I hope I did things right:

So it seems it isn't finding your model files. Is your resources folder setup as a source folder in your IDE.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

Yes it is! If you need any screen or anything, please ask away! And I'm using Intellij IDEA, and my "ressources" folder is a "Sources Root".

(Again, sooorry for the delay... I was sleeping. >.<)

Edited by Lotte
Posted
3 minutes ago, Lotte said:

(Again, sooorry for the delay... I was sleeping. >.<)

Sleep is good.

3 minutes ago, Lotte said:

Yes it is! If you need any screen or anything, please ask away! And I'm using Intellij IDEA.

Send a screenshot of your file explorer in eclipse.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Sigh... been trying to run my files with eclipse, but I always ended up having error messages. I'm really sorry, I tried... At least, I wish that can help? :/

 

owo.thumb.JPG.b1b7678b498db92d471413c069ad6563.JPG

Posted

I also just tried to add a new block, which worked perfectly fine, with the material and creative tab I wanted and such! Besides the texture, which is still that old purple-black checkerboard one...

  • Lotte changed the title to [1.12.2] Can't figure out how items/blocks's textures works...
Posted
  • Thanks 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 (edited)

I guess that should be clear, but I'm getting fastly confused with all my different files and such since I'm all new...

Can you please explain what I have done wrong and if possible what I need to do? ;~;

 

EDIT: I just learned how to use the different settings for blocks such as setHardness and all, and my block words fine. Only the textures is going wrong. ;c 

Edited by Lotte
Posted (edited)
32 minutes ago, Lotte said:

I guess that should be clear, but I'm getting fastly confused with all my different files and such since I'm all new...

Can you please explain what I have done wrong and if possible what I need to do? ;~;

1) You do not need a class called BlockBase or ItemBase because "base" block and item classes already exist. They're called Block and Item. A "base" class that saves you from having to write a few lines of code over and over again is an anti-pattern. What happens if you want to write your own Fence block? Well, now you can't inherit from BlockBase because BlockBase isn't a Fence and you'd have to copy all of that code. But you can't inherit from FenceBlock because now you have to write all your BlockBase code again.

 

2) You do not need IHasModel. Two very very simple reasons. One: all items need models, no exceptions. Blocks that need item models also (gasp!) have items and all items need models. Two, the information that you expose in the methods specified by IHasModel are already public. So you perform a completely pointless instanceof and class cast to call a method that does nothing useful.

 

See this method:

https://github.com/LotteWiltshy/lottycraft-mod/blob/master/LottyCraft/src/main/java/com/lotty/lottycraft/util/handler/RegistryHandler.java#L21-L30

 

Watch this:

    @SubscribeEvent
    public static void onModelRegister(ModelRegistryEvent event)
    {
        for(Item item : ModItems.ITEMS)
        {
            Main.proxy.registerItemRenderer(item, 0, "inventory");
        }
    }

 

HOLY SHIT BALLS BABY JESUS, IT FUCKING WORKS

 

Except, for you know, the ModelRegistryEvent is SideOnly(CLIENT) so you can't actually have this here....

 

Oh, also:

https://github.com/LotteWiltshy/lottycraft-mod/blob/master/LottyCraft/src/main/java/com/lotty/lottycraft/init/ModItems.java#L13-L14

Problematic Code #14

Edited by Draco18s
  • Thanks 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

Thanks for your help! I threw Intellij IDEA away for Eclipse, and it worked without any problem with the files I used... so no idea, but thanks anyway! ?

  • Lotte changed the title to [SOLVED] [1.12.2] Can't figure out how items/blocks's textures works...

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.