Torchmaster

Torchmaster

64M Downloads

Incorrect Distance Math for Mega Torch

bearsdotzone opened this issue ยท 1 comments

commented

Per this at the second stage of the conditional no mobs will ever spawn above a mega torch's y level while still being in the x,z radius.

Example: Mega torch at y level 0 100 0. Potential mob spawn location at 0 170 0, well outside the default radius of 32 but within the same x,z radius. dy = 100 + 0.5 - 170 == -69.5 which is less than 32 and evaluates as true causing no mobs to spawn at this location.

I suggest the simple fix

(dx * dx + dz * dz + dy * dy) <= (this.torchRangeSq)

which is just the pythagorean theorum in 3 dimensions.

commented

The issue with your suggested fix is, it transforms the checking volume from a cylinder to a sphere, which i didnt want.
I'll prepare a fix which should be up on curseforge in a few hours ๐Ÿ˜ƒ

Thank you for your feedback!