Botania (Fabric/Quilt)

Botania (Fabric/Quilt)

6M Downloads

Loki ring can "NBT ban" a player due to unlimited offset list size

TheRealWormbo opened this issue ยท 0 comments

commented

Mod Loader

Both Fabric and Forge (I confirm that I have tested both loaders and will specify both loader versions below)

Minecraft Version

1.20.1

Botania version

444

Modloader version

(any)

Modpack info

No response

The latest.log file

(n/a)

Issue description

From Discord:

hey guys, is the loki ring, in botania, have a maximum selection bloc ? i got this error while i was setting up my ring
Connection Lost message

Apparently that person attempted to select 31 16x16 block layers, i.e. nearly 8000 individual blocks, at the same time.

Steps to reproduce

No response

Other information

The Loki ring uses a relatively inefficient way to store its coordinates: Each block position and offset is represented by a set of three integer tags, and the offsets are additionally wrapped in a compound tag with an index as the suffix of its name.

I propose two optimizations: Block positions/offsets should be stored as the BlockPos long value representation, and the offsets should use a LongList tag.
Additionally, the mana cost calculation needs to be hardened against integer overflows. It raises e to the power of a quarter of the number of positions to affect, which likely causes issues starting around 80 or so offsets. (The exponentiation seems unnecessary past 10 offsets.)