Vampirism - Become a vampire!

Vampirism - Become a vampire!

16M Downloads

[Bug]: Sun detection gets offset when coordinates are negative

TBiscuit1 opened this issue ยท 2 comments

commented

Minecraft Version

1.20.1

(Neo)Forge Version

47.3.0

Vampirism Version

1.10.11

Modpack

No response

Singleplayer/Multiplayer

Both

What happened?

When you are a vampire, the sun detection seems to be offset by 1 in the x axis, causing the player to burn in places where they shouldn't and vice versa

For example, when I'm directly under a log, I start burning which is not normal
2024-10-18_23 35 01

However, if I go 1 block negatively in the x axis, (to the left of the log) I stop burning all of a sudden
2024-10-18_23 34 55

If it is supposed to have some sun offset depending on the time, then it is not working because this bug happens at any time of the day and always +1 in the x axis

Relevant log output

No response

Reproduce steps

No response

Other relevant mods

No response

commented

After further analysis, it only happens if the x coords is negative, which means it is likely also happening in the z axis (In my experiment my z coord was 2800)

commented

So, looking at the code, there is a cast of the player's coord into an integer which causes the value to be rounded wrong when it is negative (causing the offset)

To fix this, simply floor the value and that should give the proper coordinates