tModLoader / tModLoader

A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations
https://www.tmodloader.net/
MIT License
4.16k stars 1.87k forks source link

Bug with modded underground backgrounds #3569

Open DylanDoe21 opened 1 year ago

DylanDoe21 commented 1 year ago

Version

Latest 1.4.4-preview

OS

Windows

Platform

Steam

This bug affects

Mod capability as a Modder

Description

There is an issue with the preview version of tmodloader where modded underground backgrounds will break underground backgrounds.

It will turn all underground backgrounds black, and will throw this error multiple times in chat: Screenshot_457

Not only that, if this issue is happening in game, changing the lighting mode to retro or trippy will crash the game, like this: crash

What is also odd is that in the lava layer, no underground backgrounds will draw at all and unlit tiles will not render: Screenshot_890

It will also not render any blocks where the top of the background is: Screenshot_459

It was found when using tmodloader dev version, that it seems a certain background image in vanilla (Background_2.png) is not being loaded properly, though I am still unsure what is causing this in the first place.

Log File

This is the only thing found in the client.log when this issue occurs: client.log

Steps to reproduce

-Add a modded underground background, apply it via a mod biome or something, build and reload the mod, then close and re-open the game. For whatever reason, adding a modded underground background works perfectly fine when added, but as soon as you close and re--open the game, this issue happens. -After that, the underground backgrounds will be black and the issue "Attempted to divide by zero" will show up in the chat. This will affect both modded and vanilla backgrounds. -The only way to stop the issue is by removing where the modded underground background is applied, build and reload the mod, and then exit and re-open the game once more.

Expected Behavior

Modded underground backgrounds should work normally.

Actual Behavior

Modded backgrounds with certain mods is causing an issue where they become completely black, and the issue "attempted to divide by zero" shows up in the chat sometimes.

Reproduction frequency

Always happens with steps listed above, with certain mods, such as my own: https://github.com/DylanDoe21/Spooky Another mod that has been experiencing similar issues is the confection mod: https://github.com/Lion8cake/ConfectionREBAKED/tree/1.4.4

Additional Information

It is worth noting that this issue only seems to happen with certain mods, and each individual mod that I have seen experiencing this issue have gotten it in different ways. This issue is very strange and it only started in the 1.4.4 version of tmodloader.

JavidPack commented 1 year ago

@Chicken-Bones is this the same issue you fixed earlier? Have we received confirmation of the fix yet?

Chicken-Bones commented 1 year ago

@DylanDoe21 still to test. I could not repro this before fixing, despite trying.