Dynmap-Forge/Fabric

Dynmap-Forge/Fabric

888k Downloads

ArrayIndexOutOfBoundsException when rendering the nether roof

Santobert opened this issue ยท 4 comments

commented

Issue Description:
When rendering the nether roof with a maximumheight of 256 an ArrayIndexOutOfBoundsException occurs in this line:

This seems reasonable since the section array has a length of 16 (256/16) so the highest index is 15 and 256 >> 4 equals 16.
When I reduce maximumheight to 255, the highest layer won't be rendered, but at least no exception occurs.

  • Dynmap Version: Dynmap-3.1-beta5-spigot
  • Server Version: git-Paper-350 (MC: 1.16.4)
  • Server Host (if applicable): Selfhosted
  • Steps to Replicate:
  1. Build in the nether up to the maximum build height
  2. Create a custom perspective with a maximumheight of 256 so that the highest layer of the nether get's rendered
  3. Use this perspective in your setup
  4. Issue a fullrender dynmap fullrender world_nether
  5. Observe the logs, the render will abort with an exception
  • I have looked at all other issues and this is not a duplicate
  • I have been able to replicate this

custom-perspectives.txt

# The user is free to add new and custom perspectives here, including replacements for standard ones
# Dynmap's install will not overwrite it
perspectives:
  - class: org.dynmap.hdmap.IsoHDPerspective
    name: nether_top_90_lowres
    maximumheight: 256
    minimumheight: 128
    azimuth: 180
    inclination: 90
    scale: 4
  - class: org.dynmap.hdmap.IsoHDPerspective 
    name: nether_top_60_lowres
    maximumheight: 256
    minimumheight: 128
    azimuth: 135
    inclination: 30
    scale: 4

Relevant part of worlds.txt

[...]
-   name: world_nether
    title: world_nether
    enabled: true
    extrazoomout: 2
    maps:
    -   class: org.dynmap.hdmap.HDMap
        name: flat
        title: Flat
        prefix: flat
        perspective: iso_S_90_lowres
        shader: stdtexture
        lighting: default
        mapzoomin: 2
        background: '#300806'
    -   class: org.dynmap.hdmap.HDMap
        name: nether
        title: Surface
        prefix: nt
        perspective: iso_SE_30_lowres
        shader: stdtexture
        lighting: default
        mapzoomin: 2
        background: '#300806'
    -   class: org.dynmap.hdmap.HDMap
        name: roof_flat
        title: Roof Flat
        icon: images/block_nether_flat.png
        prefix: roof_flat
        perspective: nether_top_90_lowres
        shader: stdtexture
        lighting: default
        mapzoomin: 2
        background: '#300806'
    -   class: org.dynmap.hdmap.HDMap
        name: roof
        title: Roof Surface
        icon: images/block_nether_surface.png
        prefix: roof
        perspective: nether_top_60_lowres
        shader: stdtexture
        lighting: default
        mapzoomin: 2
        background: '#300806'
[...]

Traceback

> dynmap fullrender world_nether:roof
[23:54:17 INFO]: Full render starting on world 'world_nether'...
[23:54:29 INFO]: Full render of map 'roof' of 'world_nether' in progress - 100 tiles rendered (115,83 msec/tile, 68,40 msec per render)
[23:54:40 INFO]: Full render of map 'roof' of 'world_nether' in progress - 200 tiles rendered (112,95 msec/tile, 68,22 msec per render)
[23:54:47 ERROR]: [dynmap] Exception during render job: world=world_nether, map=org.dynmap.hdmap.HDMap@7f3ddad0
[23:54:47 WARN]: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
[23:54:47 WARN]:        at org.dynmap.bukkit.helper.v116_4.MapChunkCache116_4$NBTSnapshot.getBlockType(MapChunkCache116_4.java:273)
[23:54:47 WARN]:        at org.dynmap.bukkit.helper.AbstractMapChunkCache$BasetMapIterator.getBlockType(AbstractMapChunkCache.java:138)
[23:54:47 WARN]:        at org.dynmap.hdmap.IsoHDPerspective.render(IsoHDPerspective.java:1260)
[23:54:47 WARN]:        at org.dynmap.hdmap.HDMapTile.render(HDMapTile.java:79)
[23:54:47 WARN]:        at org.dynmap.MapManager$FullWorldRenderState.processTile(MapManager.java:804)
[23:54:47 WARN]:        at org.dynmap.MapManager$FullWorldRenderState.run(MapManager.java:720)
[23:54:47 WARN]:        at org.dynmap.MapManager$DynmapScheduledThreadPoolExecutor$1.run(MapManager.java:229)
[23:54:47 WARN]:        at org.dynmap.MapManager$DynmapScheduledThreadPoolExecutor$2.run(MapManager.java:245)
[23:54:47 WARN]:        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[23:54:47 WARN]:        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[23:54:47 WARN]:        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
[23:54:47 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[23:54:47 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[23:54:47 WARN]:        at java.base/java.lang.Thread.run(Thread.java:832)

Maybe related reddit posts

commented

Seems to work. Awesome! Thank you! ๐ŸŽ‰

commented

When can we expect the next stable release? Running Dev in production seems a bit risky to me. ๐Ÿ˜

commented

Give latest dev build a try (https://dynmap.us/builds/dynmap/Dynmap-3.1-SNAPSHOT-spigot.jar ) - should handle this case

commented

Well, the good news is that THIS dev build is exactly the first build after the last release build, and has nothing changed except for your fix :)

Next release build will be at least 2-3 weeks, unless something critical comes up.