Posted June 26, 201510 yr Hello, i am currently developing mod, which bring clans into the game and i need pass the clan's icon from server to client. This icon have a light weight (it's 16x16) and i think it will be good to keep them all in ./icons folder of the Minecraft directory. But i don't know to convert File to ResourceLocation to render it in the game. Can somebody help me with this?
June 26, 201510 yr 1. Pack all .png to 256x256 sheet. 2. Put that sheet somewhere in server files. 3. Create SpecialResourcePack extends AbstractResourcePack (or FileResourcePack). 4. Use packets (send .png as stream): either SimpleNetworkWrapper or setup your own sending (open new thread) 5. On receiver (client) side you will now have some .png - use SpecialResourcePack to load image as resource (inputStream). 6. Use: mc.getTextureManager().bindTexture(textureSheet); this.drawTexturedModalRect(x, y, u, v, 16, 16); To draw image. Note: Instead of writing whole new implementation of ResourcePack you can use FileResourcePack. 1. After finishing downloading .png, place it into .zip or .jar (on client side). 2. Load .jar/.zip as FileResourcePack. 3. That way you will also inherit file structure (e.g: assets/something/lol/textureSheet.png) of that .jar. Example of loading FileResourcePack: List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao"); defaultResourcePacks.add(new MyFileResourcePack(new File("C:/Users/Me/Something/.minecraft/theJar.jar"))); Minecraft.getMinecraft().refreshResources(); 1.7.10 is no longer supported by forge, you are on your own.
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.