Jump to content

Recommended Posts

Posted

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.

Posted

This is intentional, why are you overriding someone elses's texture?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

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?

Posted

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.

Posted

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.

Posted

Unneeded suggestion, answer is no. You can do it correctly with already exposed vanilla mechanics. No hacking needed...

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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