Vampirism - Become a vampire!

Vampirism - Become a vampire!

16M Downloads

[Bug]: ticking exception

Rainmlwm opened this issue · 3 comments

commented

Minecraft Version

1.20.1

(Neo)Forge Version

47.3.10

Vampirism Version

1.20.1

Modpack

https://www.curseforge.com/minecraft/modpacks/darkrpg-forge

Singleplayer/Multiplayer

Singleplayer

What happened?

The game prompted a ticking exception on my player, and I was been kicked out of the world to prevent the game from crashing.

Relevant log output

crash-2024-10-01_18.04.27-server.txt

Reproduce steps

Use commands to teleport to a certain place on the map, and then attack the creatures you meet. The game crashes at the moment of attacking the creatures, and it will crash within a few seconds even if you re-enter the game.

Other relevant mods

Modpack:DarkRPG Forge - RPG with Magic, Quests & Vampires

commented

From ChatGPT:

Error Source:

The key part in the report is the VampireBaronEntity.suggestEntityLevel method, which attempts to use a non-positive value (possibly zero or negative) as a bound for the random number generator, which results in an IllegalArgumentException.

Related Mods:

The mods mentioned in the report are oculus and embeddium_extra, which, while not necessarily the direct cause of the problem, may interact with the functionality of the Vampirism mod.

Crash Trigger:

The error occurs in the server thread, usually when processing an event for an entity to join the world, which may be related to naturally spawned mobs.

commented

Does this happen regularly or was this a one off exception?

@Cheaterpaul
My suspicion is that there are only non-alive players in this method leading to min=Integer.MAX_VALUE being passed to the Difficulty here:

We probably also want to add some sanity checks to Difficulty.
But I also do not understand the calculations in suggestEntityLevel

If I find time tomorrow, I will do this. If not, can you fix this later please.

commented

Its weird that this has not happened before as the problem exists on almost all Vampirism versions. But the chance is quite low...

Anyways, I have fixed it for 1.20 and up.
On NeoForge versions, the system was completely broken as well.

@Rainmlwm Next release should fix this, thank you for reporting.