Jump to content

Items look weird and crooked in inventory


Aldie

Recommended Posts

So I'm working on a mod that adds new weapons to the game, but when I added the texture for one of my items it renders weird in the inventory. As you can see, the item in question looks identical to the vanilla iron sword, rendering perfectly both as a dropped item and as the model help in hand, it's only in the inventory itself that it looks all crooked.

 

The item texture was originally 18x18 as opposed to the default multiple of 16 (64x64 I believe). The problem persisted even when I rescaled it to a multiple of 16.

Is there any workaround for this? Some way to get it rendering properly?

2020-02-02_17.11.38.png

Link to comment
Share on other sites

Don't use non-power-of-2 textures. 

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

Maybe try a lower resolution, 512x512 is really high and not necessary.

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/

Link to comment
Share on other sites

20 hours ago, larsgerrits said:

Maybe try a lower resolution, 512x512 is really high and not necessary.

I did so but the problem persisted. The problem seems to be caused by some element in Minecraft's code forcing any item to visually fit into a maximum grid resolusion of 32x32, i.e. I can't just resize the item's texture to 128x128 (which looks alright everywhere outside the inventory), because the inventory forces the image into that damned 32x32 frame. To clarify why I specifically need my items 18x18, the mod I'm making offers stronger versions of vanilla minecraft weapons, such as the "mythic iron sword", which are visually derived from the vanilla weapons. Without that extra couple of pixels, I can't really emphasize the progression, visually, and 32x32 would be TOO large for this task. 18x18 (or maybe 20x20) would be the Goldilocks zone.

 

I'll phrase my question in a simpler manner then. Is there any way to get Minecraft to render hd textures in the inventory?

 

I'll really appreciate any help I get since I've been really hyped to work on this mod for some time and learnt Java specifically therefor.

Link to comment
Share on other sites

Inventory squares are always the same size. You can't just "add a few extra pixels" and make it work. The image is going to get scaled down to fit within that space and that space is only 32x32 on screen (actually, its 16x16, but the default UI size is scaled up by a factor of 2 with a intrapixel mode of "nearest").

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

9 minutes ago, Draco18s said:

Inventory squares are always the same size. You can't just "add a few extra pixels" and make it work. The image is going to get scaled down to fit within that space and that space is only 32x32 on screen (actually, its 16x16, but the default UI size is scaled up by a factor of 2 with a intrapixel mode of "nearest").

Alright. I'll try a few alternatives. Should I upload separate threads for different questions relating to the same subject (relating to different coding issues but to the same end goal) or should I keep posting here with further questions?

 

Thanks for your help by the way.

Link to comment
Share on other sites

Unless your plan is to hack the gui systems to draw your items with more pixels, I suspect that nothing will do what you want. 

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

22 hours ago, Draco18s said:

Unless your plan is to hack the gui systems to draw your items with more pixels, I suspect that nothing will do what you want. 

Well, that was my original plan. To modify the element in Minecraft's code which renders the items' textures in the inventory, or replace the vanilla GUI with my own GUI that can accommodate 18x18 textures (possibly with GuiOpenEvent or some other black magic :P). Is this possible? Could you help me do this?

 

If not, there were two alternatives I had in mind:

1) Render the items in the inventory with an alternative model (I've seen this done before in mods; items using various 3d models instead of a 2d texture). I'm not sure how to do this so I'd appreciate any help.

 

2) Use different textures for the handheld/dropped item and the item in the inventory. This is the simplest option, and I know this is entirely doable, but it's not the best one.

 

Thanks for all your help.

Link to comment
Share on other sites

Step 0:

Open an image editing program and draw what you want your 18 pixel sword to look like in the inventory.

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

You could also emphasise the progression by having unique textures that look good or your own custom models.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

On 2/5/2020 at 12:40 AM, Draco18s said:

Step 0:

Open an image editing program and draw what you want your 18 pixel sword to look like in the inventory.

Well, this is actually quite embarrassing, but I already made all of the textures for all of the swords of all 15 materials of which I wish to make swords, before even starting the mod itself. (Below are ten of them.)

 

What's step one?

Stone_LongSwords (1).png

Diamond_LongSwords (1).png

Golden_LongSwords (1).png

Wooden_LongSwords (1).png

Iron_LongSwords (1).png

Coal_LongSwords.png

Flint_LongSwords.png

Quartz_LongSwords.png

Redstone_LongSwords.png

Obsidian_LongSwords.png

Link to comment
Share on other sites

Those are graphical assets, but they are not in the UI. Draw what the player will see when they open their inventory.

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

  • 2 weeks later...
On 2/7/2020 at 12:19 AM, Draco18s said:

Those are graphical assets, but they are not in the UI. Draw what the player will see when they open their inventory.

Hey, sorry I disappeared for a couple of weeks, it's been hectic with finals and all.

 

I drew three options to what the UI should look like, from best option to least preferable option:

 

Edit: To clarify, black pixels are the border of the item texture and red is the item.

sword- (1).png

sword (3).png

Edited by Aldie
Link to comment
Share on other sites

Yep, you're going to have to hack Minecraft's itemstack UI renderer.

Have fun!

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

Go with #1 and 16x16 textures. Textures should be a power of two. So 8, 16, 32, 64. They should also be no larger than 16 because of this and this.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

On 2/17/2020 at 12:30 AM, Draco18s said:

Yep, you're going to have to hack Minecraft's itemstack UI renderer.

Have fun!

Well, for options one and two you're right, but for option three? I know there's an option to have the model for handheld items/dropped items be different than the model used in the inventory. How would I tackle that?

 

And if that isn't good enough, where would I start if I wanted to hack the itemstack UI renderer? Is there documentation for this?

Link to comment
Share on other sites

1 hour ago, Aldie said:

I know there's an option to have the model for handheld items/dropped items be different than the model used in the inventory. How would I tackle that?

I know this is possible, I think I saw a thread on it a week ago. Something about using a smaller part of a texture for an item.

 

1 hour ago, Aldie said:

Is there documentation for this?

No, there is not.

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

@Aldie, ehm, can you show us your mod on Github or something else? But with custom model you can use Blockbench to make your Item model, then Export it as a Json file and instead of Minecraft itemheld model you can use the Json file model. Then you will have your Model that should work with the Inventory rendering.

New in Modding? == Still learning!

Link to comment
Share on other sites

On 2/2/2020 at 4:36 PM, Aldie said:

The item texture was originally 18x18 as opposed to the default multiple of 16 (64x64 I believe). The problem persisted even when I rescaled it to a multiple of 16.

Why you are using 16x16 Texture? You should use 18x18 Texture, then the Problem should be disappear. I think you simply need to set the Texture to 18x18, and then try to resize the others Textures to make it size to 18x18, but first try with .

New in Modding? == Still learning!

Link to comment
Share on other sites

On 2/2/2020 at 4:36 PM, Aldie said:

So I'm working on a mod that adds new weapons to the game, but when I added the texture for one of my items it renders weird in the inventory. As you can see, the item in question looks identical to the vanilla iron sword, rendering perfectly both as a dropped item and as the model help in hand, it's only in the inventory itself that it looks all crooked.

 

The item texture was originally 18x18 as opposed to the default multiple of 16 (64x64 I believe). The problem persisted even when I rescaled it to a multiple of 16.

Is there any workaround for this? Some way to get it rendering properly?

2020-02-02_17.11.38.png

@Aldie, this Video will definitively help you (it was made for older Version but should still work):

 

New in Modding? == Still learning!

Link to comment
Share on other sites

On 2/21/2020 at 12:08 PM, DragonITA said:

Why you are using 16x16 Texture? You should use 18x18 Texture, then the Problem should be disappear. I think you simply need to set the Texture to 18x18, and then try to resize the others Textures to make it size to 18x18, but first try with .

No. They already tried this. It doesn't work. Because the game scales any texture you give it down to fit into a space meant to be occupied by a 16x16 texture.

 

  • 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.

Link to comment
Share on other sites

8 hours ago, Draco18s said:

No. They already tried this. It doesn't work. Because the game scales any texture you give it down to fit into a space meant to be occupied by a 16x16 texture.

 

 

12 hours ago, DragonITA said:

@Aldie, this Video will definitively help you (it was made for older Version but should still work):

 

 

New in Modding? == Still learning!

Link to comment
Share on other sites

  • 4 weeks later...
On 2/21/2020 at 7:31 PM, DragonITA said:

@Aldie, ehm, can you show us your mod on Github or something else? But with custom model you can use Blockbench to make your Item model, then Export it as a Json file and instead of Minecraft itemheld model you can use the Json file model. Then you will have your Model that should work with the Inventory rendering.

Here's a link to the whole mod: https://drive.google.com/open?id=1llGhCc5zKeQ3gO-nQlZvs8R_POdkoisa

(Sorry it's not github, I don't know how to use github.)

(Also sorry it took me a month to respond. I've been busy lately.)

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.