Posted February 13, 20178 yr I want to give some of my slots custom background icons (like the vanilla armour slots have). I tried setting the backgroundName or backgroundLocation in the constructor - when I do the first, it renders as the missing image texture, when I do the second it has the usual blank background. Am I missing something obvious? Edited February 13, 20178 yr by Jay Avery Solved
February 13, 20178 yr You should read the vanilla minecraft classes and find out what they do. Edited February 13, 20178 yr by Leomelonseeds Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
February 13, 20178 yr Author 13 minutes ago, Leomelonseeds said: You should read the vanilla minecraft classes and find out what they do. I've already done that. The vanilla armour slots override Slot#getSlotTexture and return a string with the path to the texture. Doing that in my slots also resulted in the missing image texture. I've read through the Slot class but it seems to use a convoluted mixture of strings and ResourceLocations, and something to do with TextureAtlasSprites - I have no idea what those are.
February 13, 20178 yr Mabye you typed the string wrong? Show your code. Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
February 13, 20178 yr Author Finally got it working! I had to use TextureStitchEvent.Pre to register the sprite, like so: @SubscribeEvent public void textureStich(TextureStitchEvent.Pre event) { event.getMap().registerSprite(new ResourceLocation("jjmod:gui/backpack_slot")); } And also set the background name to the same string in the Slot constructor: this.backgroundName = "jjmod:gui/backpack_slot"; Edited February 13, 20178 yr by Jay Avery
February 13, 20178 yr Cool, glad you got it working without our help. Next time try solving on your own before posting here. Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
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.