Rapid map updates causes client throw NullPointerException?

Discussion in 'Plugin Development' started by Cirno, Oct 11, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    I'm currently rewiring the back-end for video streaming. In order to achieve "30fps"-like map changes, I've created my own PacketPlayOutMap class (extends) that is injected on server-startup. The only changes to the class was the field "h" being changed from a byte[] to a ByteBuffer (direct so JNI can access it via (*env)->GetDirectBufferAddress).

    Now the problem is that I send out these packets as fast as I can (I've added delays, i.e 1 whole second delays via Thread.sleep; still the same error :() in a separate thread to the player (via EntityPlayer.playerConnection.channel.writeAndFlush). However, I notice at some point, the client starts to throw NullPointerExceptions and the map fails to update its contents:
    [18:19:55] [Client thread/FATAL]: Error executing task
    java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
        at g.a(SourceFile:45) [1.8.8.jar:?]
        at ave.av(SourceFile:881) [1.8.8.jar:?]
        at ave.a(SourceFile:325) [1.8.8.jar:?]
        at net.minecraft.client.main.Main.main(SourceFile:124) [1.8.8.jar:?]
    Caused by: java.lang.NullPointerException
    Anyone familiar with this error and if-so, any work-arounds?

    Well this is slightly awkward, in 1.8.x, there was an addition of colors.

    My original method of matching colors only matched up to color ID 127; there are now 143 colors. Not sure how that caused NullPointerExceptions to begin with, but it seems to have fixed it.
    For future reference, if anyone is to use the matchColor method in MapPalette (which is where I got my JNI/C version of matchColor from), note that it won't count in the new 1.8 colors. You can probably decompile and recompile by changing the line:
    return (byte)(index < 128?index:-129 + (index - 127));
    return (byte)(index < 143 ? index : -144 + (index - 143));
    EDIT by Timtower: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 12, 2015
  2. Offline


    I've tried doing something similar (trying to make gifs out of maps), but I could not find a way to update the maps fast enough (It caused tearing/not fully updated maps). How did you achieve this?
Thread Status:
Not open for further replies.

Share This Page