Antique Atlas

Antique Atlas

32M Downloads

New Network Build spamming logs

CovertJaguar opened this issue ยท 10 comments

commented

This happens when players try to log in, using the 1.9.4 version.

[03:25:41] [Server thread/ERROR] [FML/]: SimpleChannelHandlerWrapper exception
io.netty.handler.codec.EncoderException: java.lang.NullPointerException
	at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[minecraft_server.1.10.2.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) [SimpleNetworkWrapper.class:?]
	at hunternif.mc.atlas.network.PacketDispatcher.sendTo(PacketDispatcher.java:82) [PacketDispatcher.class:?]
	at hunternif.mc.atlas.marker.MarkersData.syncOnPlayer(MarkersData.java:223) [MarkersData.class:?]
	at hunternif.mc.atlas.marker.GlobalMarkersData.syncOnPlayer(GlobalMarkersData.java:26) [GlobalMarkersData.class:?]
	at hunternif.mc.atlas.marker.GlobalMarkersDataHandler.onPlayerLogin(GlobalMarkersDataHandler.java:64) [GlobalMarkersDataHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_421_GlobalMarkersDataHandler_onPlayerLogin_PlayerLoggedInEvent.invoke(.dynamic) [?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerLoggedIn(FMLCommonHandler.java:565) [FMLCommonHandler.class:?]
	at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:228) [mp.class:?]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:260) [NetworkDispatcher.class:?]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:73) [NetworkDispatcher.class:?]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:209) [NetworkDispatcher$1.class:?]
	at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:287) [eo.class:?]
	at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:180) [md.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:732) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
	at hunternif.mc.atlas.network.client.MarkersPacket.write(MarkersPacket.java:83) ~[MarkersPacket.class:?]
	at hunternif.mc.atlas.network.AbstractMessage.toBytes(AbstractMessage.java:89) ~[AbstractMessage.class:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:30) ~[SimpleIndexedCodec.class:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:26) ~[SimpleIndexedCodec.class:?]
	at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]
	at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[minecraft_server.1.10.2.jar:?]
	at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[minecraft_server.1.10.2.jar:?]
	... 27 more

https://github.com/AntiqueAtlasTeam/AntiqueAtlas/blob/1.9.4/src/main/java/hunternif/mc/atlas/network/client/MarkersPacket.java#L83

commented

Looks very funny - just like the log spammer module from Wurst.

commented

Were there any custom markers that you changed?

commented

I was unable to recreate this issue. Was this an existing world that you updated to the new jar?

commented

Yep, it was on the server, but you probably know that now.

commented

I figured out the steps to reproduce:

  1. Start a server in 1.9.4 pre packet rework (eg. commit 06c1ae5)
    • 0834a98 is the commit that introduces the name change
  2. Find an end city with an antique atlas
  3. Upgrade the server to post packet rework
  4. Open any atlas, even a new one, and close it.
commented

This appears to cause the booting problem on the Railcraft server due to an overlooked name change for end cities (I still need to confirm this). The old icons are now understood to be custom tiles, and the new icons aren't in the server's config file, but are in the client's config file (they're added every time on startup, since they're built-in).

If all goes well, this can be solved by adding the new end cities to the server's config, and changing the old ones to custom textures that look the same.

This still needs testing, and begs the question "if the client added the new names automatically, why didn't the server?"

commented

The actual null value is introduces when reading from NBT (specifically in MarkersData.readFromNBT). A call to MarkerRegistry.find("antiqueatlas.EndCity_Far") returns null.

commented

It looks like custom markers are set up incorrectly. Types are only loaded on the client side, meaning that custom markers don't work on the server. This is because types are of type "MarkerType", which has rendering information.

The solution is to make maker types of type "String", and be equal to their name in the registries. MarkerType objects should only be fetched during rendering. This allows marker types to work server side.

commented

Marker type is now stored as mostly a string, equal to what used to be MarkerType.getRegistryName.toString(). In this case, the corresponding MarkerType object for rendering can be accessed with MarkerRegistry.find(type).

I think this will work.

commented

Fixed. Those who had this problem (eg. see two undefined textures in the marker list) might consider the following config file, which makes old end cities behave just like new end cities:

{
  "version": 1,
  "data": {
    "antiqueatlas:Example": {
      "__comment": [
        "Any of these values can be ommited. The mod will either use the default value or if it is already been registered it will keep the existing values",
        "This example entry is never parsed, and if modified, will not persist"
      ],
      "textures": [
        "List of icons at different resolutions",
        "[Default: `antiqueatlas:textures/gui/markers/red_x_small.png`]"
      ],
      "size": "[Default: 2] The width and height of the marker, in tiles (a chunk at 1x zoom)",
      "clipMin": "[Default: -1000] The minimum zoom, -1 is 1/2x, -2 is 1/4x, ...",
      "clipMax": "[Default:  1000] The maximum zoom, 0 is 1x, 1 is 2x, ...",
      "alwaysShow": "[Default: false] True if the marker should appear regardless of whether hide markers is on",
      "isTile": "[Default: false] True if the marker should scale with the map",
      "isTechnical": "[Default: false] True if user should not be able to place the marker on the map",
      "centerX": "[Default: 0.5] The point in the image that should be at the location of the marker (0-1)",
      "centerY": "[Default: 0.5] The point in the image that should be at the location of the marker (0-1)"
    },
    "antiqueatlas:EndCity": {
      "textures": [
        "antiqueatlas:textures/gui/markers/end_city.png"
      ],
      "clipMin": -1,
      "clipMax": 1000,
      "isTechnical": true
    },
    "antiqueatlas:EndCity_Far": {
      "textures": [
        "antiqueatlas:textures/gui/markers/end_city_far.png"
      ],
      "clipMin": -1000,
      "clipMax": -2,
      "isTechnical": true
    },
    "antiqueatlas:bed": {},
    "antiqueatlas:diamond": {},
    "antiqueatlas:end_city": {},
    "antiqueatlas:end_city_far": {},
    "antiqueatlas:google": {},
    "antiqueatlas:nether_portal": {},
    "antiqueatlas:pickaxe": {},
    "antiqueatlas:red_x_large": {},
    "antiqueatlas:red_x_small": {},
    "antiqueatlas:scroll": {},
    "antiqueatlas:skull": {},
    "antiqueatlas:sword": {},
    "antiqueatlas:tomb": {},
    "antiqueatlas:tower": {},
    "antiqueatlas:village": {}
  }
}