Nothirium icon indicating copy to clipboard operation
Nothirium copied to clipboard

Support CensoredASM's onDemandAnimatedTextures feature

Open embeddedt opened this issue 2 years ago • 6 comments

The patch has been structured to involve minimal changes to Nothirium's codebase; the code that interacts with CensoredASM directly is in a separate class.

Note that this requires CensoredASM 5.18 to work correctly; I have not implemented a version restriction in the initial version of this PR.

embeddedt avatar Oct 18 '23 21:10 embeddedt

This PR seems to break Nothirium's current compatibility with OptiFine. I built a .jar myself, and when I tried to use it along with Optifine, the game will crash on entering main menu: crash-2023-10-23_12.48.52-client.txt

java.lang.NullPointerException: Unexpected error
    at meldexun.nothirium.mc.integration.CensoredASM.activateChunkSprites(CensoredASM.java:51)
    at net.minecraft.client.renderer.texture.TextureMap.handler$zzl000$triggerChunkSprites(TextureMap.java:2641)
    at net.minecraft.client.renderer.texture.TextureMap.updateAnimations(TextureMap.java)
    at net.minecraft.client.renderer.texture.TextureMap.tick(TextureMap.java:711)
    at net.minecraft.client.renderer.texture.TextureManager.tick(TextureManager.java:167)
    at net.optifine.util.TextureUtils.resourcesReloaded(TextureUtils.java:342)
    at net.optifine.util.TextureUtils$1.onResourceManagerReload(TextureUtils.java:362)
    at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121)
    at net.optifine.util.TextureUtils.registerResourceListener(TextureUtils.java:366)
    at net.minecraft.client.renderer.EntityRenderer.frameInit(EntityRenderer.java:2818)
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1312)
    at net.minecraft.client.Minecraft.runGameLoop(MinecraftMixin.java:1119)
    ...

But it works pretty great without OptiFine installed.

The original Nothirium works with and without OptiFine installed.

ZZZank avatar Oct 23 '23 05:10 ZZZank

This PR seems pretty invasive just to support this single feature. I'm currently in the process of some larger updates for Nothirium which means I will delay this PR until I have finished my updates.

Meldexun avatar Mar 27 '24 20:03 Meldexun

It seems that the compatibility issue introduced by this PR (see my last comment) is actually pretty easy to fix. An additional null check is enough for fixing this. See https://github.com/ZZZank/Nothirium/commit/a18de8c817c454a36f7335c3919873cc88200707

-        if(!LOADED)
+        if(!LOADED || ChunkRenderManager.getRenderer() == null)

I've tested this in E2EE modpack, and there's no crash during 3 hours of gameplay.

ZZZank avatar Jun 21 '24 15:06 ZZZank

given that there have been at least 4 people reaching out to me to ask how to build this PR with my minor fix, I'm providing an example build at https://github.com/ZZZank/Nothirium/releases/tag/v1.12.2-0.3.4-on_demand_texture . Note that you need to unzip the artifact.zip to get the actual mod file because it's copied directly from this github action with no modification.

I'm aware that this mod is ARR, so if Meldexun points out anything that my example build violates, I'll obviously delete this release.

ZZZank avatar Oct 17 '24 11:10 ZZZank