Jump to content

[Solved] Restoring texture overwrites for custom textures


Recommended Posts

Posted

Edit: Apparently, this has been solved some version later than mine. Don't bother reading, then =)

 

Hey,

 

since the newest version (my Forge info says build number=372), I've not been able to use texture overwrites for my custom textures.

 

Basically, I've used this setup up until now:

(Note that filePath is my own filePath, not the standard MC one)

 

	MinecraftForgeClient.preloadTexture(filePath + "terrain.png");
	MinecraftForgeClient.preloadTexture(filePath + "items.png");

String empty = "";
	for(int i = 0; i < 256; i++) empty += "1";
	SpriteHelper.registerSpriteMapForFile(filePath + "items.png", empty);
	SpriteHelper.registerSpriteMapForFile(filePath + "terrain.png", empty);

	texture1 = ModLoader.addOverride(filePath + "terrain.png", filePath + "myFirstTexture.png");
                [...]

 

This worked fine, at least last version. I personally like dynamically generated texture files better than pre-set up ones, because they're just easier to work with. Also, you can dynamically change them up according to property file settings, for example, so it just generally provides more features.

 

Anyway, since the newest 1.4.4 version, ModLoader.addOverride(customTexture, customOverride); doesn't do anything anymore [at least, visually]. The lines before work perfectly, still, and it's also adding the overrides to all the lists, but it apparently doesn't load them later.

 

I don't know if it was coincidence that it worked before, but I'd very much like it to work again.

 

 

Solution:

 

I figured out that it will work, if you set 'needApply' to stay over 0 inside onUpdate (Inside ModTextureStatic).

 


    @Override
    public void onTick()
    {
        if (oldanaglyph != anaglyphEnabled)
        {
            update();
        }
        // This makes it so we only apply the texture to the target texture when we need to,
        //due to the fact that update is called when the Effect is first registered, we actually
        //need to wait for the next one.
        tileSize = (needApply == 0 ? 0 : storedSize);
        if (needApply > 0)
        {
            //needApply--; //This stays over 0, so tileSize stays one.
        }
    }

 

I know that this way is not the appropriate solution. I don't want to bother with the rest of the logic behind this here, but I guess at least you know where to start looking when fixing it =)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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