Dijkstra Posted September 11, 2015 Posted September 11, 2015 I currently testing textures so am placing them right in the c drive but when I said the texture was at c:\\texture.png I end up with the pink and black texture, in the end i will want to get the picture from the minecraft folder\subfolder\subfolder so the principle should be the same, but i do not know how to get minecraft to look side of my mod for the texture. One other this must work with ResourceLocation. Quote
Failender Posted September 11, 2015 Posted September 11, 2015 place ur textures under src/main/resources/assets/MOID/epicsubfolder and access them via new ResourceLocation("MODID:epicsubfolder/texure.png"); (if u want to access them for gui rendering to bind it via bindTexture) Quote
Dijkstra Posted September 11, 2015 Author Posted September 11, 2015 The mod needs to able load from outside texture pack as my mod need build image first from two images given by images give by the user Quote
ItsAMysteriousYT Posted September 11, 2015 Posted September 11, 2015 You can use SlickUtil to load images from the system and also to bind it to a glContext. Download it here: http://slick.ninjacave.com/slick-util.zip Quote
ItsAMysteriousYT Posted September 11, 2015 Posted September 11, 2015 Oh god no, please don't use slick. You want to bring external resources into Minecraft's resource system? Implement IResourcePack however you wish and put it in Minecraft#defaultResourcePacks. Then you can use normal ResourceLocations as if the external resources were in your mod. But sometimes it is required to bind textures that are loaded from a BufferedImage and this is possible with slick. Quote
Dijkstra Posted September 11, 2015 Author Posted September 11, 2015 Oh god no, please don't use slick. You want to bring external resources into Minecraft's resource system? Implement IResourcePack however you wish and put it in Minecraft#defaultResourcePacks. Then you can use normal ResourceLocations as if the external resources were in your mod. So I have Implemented IResourcePack however my textures still will not load I believe it have to do something with the methods it added but i have no idea where to start. Quote
Dijkstra Posted September 11, 2015 Author Posted September 11, 2015 Here is my code from the class in question package dijkstra.wardrobe.main; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.data.IMetadataSection; import net.minecraft.client.resources.data.IMetadataSerializer; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; public class testReflections implements IResourcePack{ public static ResourceLocation oldSkin; public static AbstractClientPlayer player = Minecraft.getMinecraft().thePlayer; public static void load(){ Class Skin = AbstractClientPlayer.class; try { Field locationSkin = AbstractClientPlayer.class.getDeclaredField("locationSkin"); locationSkin.setAccessible(true); oldSkin = (ResourceLocation) locationSkin.get(player); locationSkin.set(Minecraft.getMinecraft().thePlayer, setSkin(skin.Custom)); } catch (Exception e){ e.printStackTrace(); } } private static ResourceLocation setSkin(skin skin){ switch(skin){ case Custom: return new ResourceLocation("c:\\playerModel.png"); case Default: return oldSkin; case Steve: return null; default: return null; } } private enum skin{ Default, Steve, Custom } @Override public InputStream getInputStream(ResourceLocation p_110590_1_) throws IOException { // TODO Auto-generated method stub return null; } @Override public boolean resourceExists(ResourceLocation p_110589_1_) { // TODO Auto-generated method stub return false; } @Override public Set getResourceDomains() { // TODO Auto-generated method stub return null; } @Override public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException { // TODO Auto-generated method stub return null; } @Override public BufferedImage getPackImage() throws IOException { // TODO Auto-generated method stub return null; } @Override public String getPackName() { // TODO Auto-generated method stub return null; } } It mainly for test as the moment until I can get it working right Edit: at moment is trigger ever render tick using event handlers. Quote
ItsAMysteriousYT Posted September 11, 2015 Posted September 11, 2015 But sometimes it is required to bind textures that are loaded from a BufferedImage and this is possible with slick. You do not need slick to do that. Minecraft does it already with e.g. maps. Ah - okay Never had a look at that. Quote
Dijkstra Posted September 11, 2015 Author Posted September 11, 2015 To be able to change your skin the game in real time Quote
Dijkstra Posted September 11, 2015 Author Posted September 11, 2015 At the moment I am just testing thing things are not tidy yet, and I at the time I did not really IResourcePack was i though that if that if class implemented it would let me use resources outside of the mod jar. Quote
Recommended Posts
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.