Jump to content

PlayerInDistress

Members
  • Posts

    9
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

PlayerInDistress's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I have studied this method, but do not see how it is possible to add resources. The method collects resource packs from various locations and reloads them. First, it uses resource packs from Minecraft.defaultResourcePacks, which is where I would like mine to be. Then it gets the packs in Minecraft.mcResourcePackRepository. I have looked, and it doesn't seem that there is a way to add resources to this class. It only returns a copy of it's lists. Even if I could use it, though, I would still get the side effects mentioned above. The pack would appear in the in-game resource pack list.
  2. I have looked at the way Minecraft loads resources, and cannot find a way of adding a default resource pack. However, two things should be noted. One, I do not want to add a custom resource pack in the regular way, it needs to be added the way that Minecraft forge loads mods. This is because I the resource pack should not appear in the selection menu. Second, If you look at the may minecraft refreshes resources, all of the existing resources are cleared. If a resource pack were to be added in any other way, it would likely not work once refrechResources() was called. Therefore, adding the resource to the default resource packs is the only reliable way of making sure the resource will be treated the way it should.
  3. Also, I have never made contributions to the Minecraft Forge code before, so I would be grateful if you could help with this, diesieben07. Thank you very much.
  4. The reason I need this is because I have made a custom 'add-on' system for the mod, which allows for extension blocks to be added to the mod. These add-ons are placed in a custom folder and loaded by the mod, so using the standard resource pack folder is not an option.
  5. This is a continuation of http://www.minecraftforge.net/forum/index.php/topic,27599.0.html. The original issue was loading a texture from an external location. The proposed solution for this was to use reflection to get the default Minecraft texture pack list, and this seemed to work. Until the project was finally built. I believe issue related to reflection an obfuscation, and therefore, the below code will only work in the development environment. List defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks"); Yes, I have looked at examples of using ObfuscationReflectionHelper, and I understand that you can also pass in the obfuscated name, which should make it work. However, this seems very hacky, and could be a problem if the obfuscation names changed. The main point of this suggestion is that I found that FMLClientHandler actually has access to the list of resource packs. The below code will always work, since FML isn't obfuscated. List defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), "resourcePackList"); Currently I believe this is the best solution, but seems like a bit of a workaround. If Minecraft Forge is made to give you access to Minecraft code, you shouldn't need to use reflection on it. I propose adding a method into FMLClientHandler that gives you access to the resource pack list, such as getResourcePacks() or addResourcePack(IResourcePack).
  6. Thank you very much. I am almost able to do this now, but I can't access Minecraft#defaultResourcePacks. I am not exactly sure how to use reflection. All I need to know is how to register the recourcepack, and the rest I can solve for myself.
  7. If registering an IResourcePack would make this work, then I will be happy to try it. I will not ask how to do this, nor will I ask for sample code, but it would be really helpful if I at least knew which classes handle this, or had an online reference to an example. It would really save me time looking through all of the code.
  8. Sorry for the confusion, the lucky:lucky_block is my texture from my mod. I just want it to be loaded from outside of the mod's zip file, and to do that the current entry in the TextureMap would need to be overriden. I understand that blocking this feature is intentional, but I see no harm in overriding textures. If you do, however, then there could always be some sort of check (such as !name.startsWith("minecraft:")), which would only allow modded textures to be overriden. Lastly, I have actually found a work-around solution for this problem. I have registered a new texture ("lucky:blocks/lucky_block_custom") and have created a custom model loader and used it to load my model, with my custom texture. While this woks, it requires several model loading lines to be copied from different places, feels wrong since I am not actually making a new model, will be annoying to manage and overall seems like way too much for something as basic as changing the texture. My point is, I could modify this model loader and use it to override any default minecraft texture, as well as textures from other mods. So if I am able to do this, then why shouldn't TextureMap allow it directly?
  9. Currently, a hook exists to add custom textures before the texture map is stitched, and it looks like this: public class CustomBlockTextureStitchEvent { @SubscribeEvent public void onTextureStitchedPre(TextureStitchEvent.Pre event) { event.map.setTextureEntry("lucky:blocks/lucky_block", new CustomBlockTexture()); } } This problem with this is that the forge method setTextureEntry does not allow for textures to be overriden, you can only add a texture that is not already registered. What I am trying to do is make my modded block load it's texture from an external location, so I need to add a custom TextureAtlasSprite to the registry which has a custom load method (i.e. CustomBlockTexture). However, since setTextureEntry does not allow for overrides, it has very limited use. All of the bellow functions are suggestions for what could be added to the TextureMap class to make it much more usable, but only one of the needs to be added: public boolean setTextureEntry(String name, TextureAtlasSprite entry, boolean override) { if (!mapRegisteredSprites.containsKey(name) || override) { mapRegisteredSprites.put(name, entry); return true; } return false; } public boolean clearTextureEntry(String name) { mapRegisteredSprites.remove(name); } public Map getRegisteredSprites() { return mapRegisteredSprites.put(name, entry); } The last option is particularly useful as it allows full control over the registry, but any will work.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.