UtilitiX

UtilitiX

2M Downloads

`StickyChunk` assumes 256 block world height in 1.18

malte0811 opened this issue ยท 0 comments

commented

Minecraft version

1.18.1

LibX version

1.18.1-3.1.13

UtilitiX version

1.18.1-0.3.11

Forge version

39.0.85

The latest.log file

https://gist.github.com/malte0811/4554a9522f48f642aa1099771e8984d0

Issue description

In 1.18 the default world height is 384 blocks, but the StickyChunk class still assumes a world height of 256 blocks, both in how much memory it allocates and in the index computation (y & 0xFF). Since only the 8 least significant bits of the y-coordinate are considered, sticky-ing a block at e.g. y=300 will sticky the same block at y=300-256=44.

Additionally StickyChunks use quite a bit of memory without anyone using them, about 100 MB in a heapdump from a fresh world. LazyValues probably don't do anything here since they are populated when loading or saving the chunk. A solution would be to leave the byte array as null when a chunk does not contain any sticky block faces (which will usually be the case for most chunks).

Steps to reproduce

  1. Use glue on a block at y=300, confirm that it acts sticky when pushed by a piston.
  2. Go to the block with the same x- and z-coordinates at y=44 and observe that it also acts sticky, even though you did not use glue on it.

Other information

No response