-
Unexplained crash when connected to server with my mod
OK, upgrading the Forge server version to the one that the clients use fixed the problem. I still get timeouts sometimes, I blame that possibly on my half-functioning IPv6 stack.
-
Unexplained crash when connected to server with my mod
Forge version (server): forge-1.7.10-10.13.0.1180-universal The client has: 10.13.2.1230 As I've said, I did comment out all networking code, and the problem persisted. And the entity has worked on servers before. I've only just noticed the difference between forge versions on client and server... could this be the problem??
-
Unexplained crash when connected to server with my mod
What mod-related information is passed by a Forge server to the client (if you have such knowledge)? We could perhaps deduce it from there.
-
Unexplained crash when connected to server with my mod
The entity code: public class EntityNukePrimed extends EntityTNTPrimed { public EntityNukePrimed(World world, double x, double y, double z, EntityLivingBase who) { super(world, x, y, z, who); this.fuse = 200; // nukes explode after 10 seconds. }; public EntityNukePrimed(World world) { super(world); }; public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= 0.03999999910593033D; this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (this.onGround) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; this.motionY *= -0.5D; } if (this.fuse-- <= 0) { this.setDead(); if (!this.worldObj.isRemote) { this.nuke(); } } else { this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); } } private void nuke() { // explode with the strength of a just-overheated nuclear reactor, unless there is uranium around, in which case // it decays too. float f = 50.0F; int x1 = (int) (this.posX - 5.0); int x2 = x1 + 10; int y1 = (int) (this.posY - 5.0); int y2 = y1 + 10; int z1 = (int) (this.posZ - 5.0); int z2 = z1 + 10; int x, y, z; for (x=x1; x<=x2; x++) { for (y=y1; y<=y2; y++) { for (z=z1; z<=z2; z++) { Block block = worldObj.getBlock(x, y, z); if (block == MaddTech.blockUraniumOre) { f += 20.0F; } else if (block == MaddTech.blockUraniumBlock) { f += (50.0F * 4.5F); } else if (block == MaddTech.blockNuke) { f += 50.0F; }; }; }; }; if (f > 200.0F) { f = 200.0F; }; this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); }; }; Registered at the very start of the preInit event: EntityRegistry.registerModEntity(EntityNukePrimed.class, "MT_Nuke", 1, MaddTech.instance, 80, 3, true); And the rendering registered in ClientProxy: RenderingRegistry.registerEntityRenderingHandler(EntityNukePrimed.class, new RenderNukePrimed()); RenderNukePrimed: public class RenderNukePrimed extends Render { private RenderBlocks blockRenderer = new RenderBlocks(); public RenderNukePrimed() { this.shadowSize = 0.5F; } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntityNukePrimed p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { System.out.println("CALLED NUKE PRIME"); GL11.glPushMatrix(); GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); float f2; if ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F < 10.0F) { f2 = 1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 10.0F; if (f2 < 0.0F) { f2 = 0.0F; } if (f2 > 1.0F) { f2 = 1.0F; } f2 *= f2; f2 *= f2; float f3 = 1.0F + f2 * 0.3F; GL11.glScalef(f3, f3, f3); } f2 = (1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(p_76986_1_); this.blockRenderer.renderBlockAsItem(MaddTech.blockNuke, 0, p_76986_1_.getBrightness(p_76986_9_)); if (p_76986_1_.fuse / 5 % 2 == 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); this.blockRenderer.renderBlockAsItem(MaddTech.blockNuke, 0, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glPopMatrix(); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityNukePrimed p_110775_1_) { return TextureMap.locationBlocksTexture; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityNukePrimed)p_110775_1_); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityNukePrimed)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } } (modified version of RenderTNTPrimed)
-
Unexplained crash when connected to server with my mod
I don't do anything with vanilla packets. The only entity I use is "NukePrimed". When I added the nuke but not yet networking, it worked (except the nuke wouldn't render on clients).
-
Unexplained crash when connected to server with my mod
That might be true, but commenting out all the networking code (Except the "newsimpleChannel()" call) still makes the error persist. EDIT: I moved all registerMessage() calls to the common part, it's still happening. Now I also get: [20:00:27] [Netty Client IO #2/ERROR]: NetworkDispatcher exception io.netty.handler.codec.DecoderException: java.io.IOException: Packet was larger than I expected, found 41055 bytes extra whilst reading packet 24 at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[byteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:196) ~[byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:214) [byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75) [ChannelInboundHandlerAdapter.class:?] at io.netty.handler.timeout.ReadTimeoutHandler.channelInactive(ReadTimeoutHandler.java:143) [ReadTimeoutHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:767) [DefaultChannelPipeline.class:?] at io.netty.channel.AbstractChannel$AbstractUnsafe$5.run(AbstractChannel.java:558) [AbstractChannel$AbstractUnsafe$5.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79] Caused by: java.io.IOException: Packet was larger than I expected, found 41055 bytes extra whilst reading packet 24 NOTE: Even if I literally comment out ALL networking code, and don't even register the channel, this still happens.
-
Unexplained crash when connected to server with my mod
In the preInit event (class "LibTech"): network = NetworkRegistry.INSTANCE.newSimpleChannel("maddtech"); network.registerMessage(PacketPulserUpdate.Handler.class, PacketPulserUpdate.class, 0, Side.SERVER); MaddTech.proxy.registerMessages(network); registerMessages() on CommonProxy is empty. In ClientProxy: public void registerMessages(SimpleNetworkWrapper network) { network.registerMessage(PacketInvokeEffect.Handler.class, PacketInvokeEffect.class, 100, Side.CLIENT); }; PacketInvokeEffect: public class PacketInvokeEffect implements IMessage { public static final int SMOKE = 0; public int dim; public int x; public int y; public int z; public int effect; public PacketInvokeEffect() { }; public PacketInvokeEffect(World world, int x, int y, int z, int effect) { this.dim = world.provider.dimensionId; this.x = x; this.y = y; this.z = z; this.effect = effect; }; @Override public void fromBytes(ByteBuf buf) { dim = buf.readInt(); x = buf.readInt(); y = buf.readInt(); z = buf.readInt(); effect = buf.readInt(); }; @Override public void toBytes(ByteBuf buf) { buf.writeInt(dim); buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); buf.writeInt(effect); }; public static class Handler implements IMessageHandler<PacketInvokeEffect, PacketInvokeEffect> { public Handler() { }; @Override public PacketInvokeEffect onMessage(PacketInvokeEffect packet, MessageContext ctx) { Random random = new Random(); double offX = 0.1*(random.nextGaussian()-0.5); double offZ = 0.1*(random.nextGaussian()-0.5); World world = Minecraft.getMinecraft().theWorld; if (world.provider.dimensionId == packet.dim) { switch (packet.effect) { case SMOKE: world.spawnParticle("smoke", (double)packet.x+0.5+offX, (double)packet.y, (double)packet.z+0.5+offZ, 0.0, 0.1+0.1*(double)random.nextGaussian(), 0.0); }; }; return null; }; }; }; Code that sends such packet (server-side): LibTech.network.sendToAll(new PacketInvokeEffect(world, x, y, z, PacketInvokeEffect.SMOKE)); PacketPulserUpdate: public class PacketPulserUpdate implements IMessage { public int dim; public int x; public int y; public int z; public int cycleDuration; public PacketPulserUpdate() { }; public PacketPulserUpdate(World world, int x, int y, int z, int cycleDuration) { this.dim = world.provider.dimensionId; this.x = x; this.y = y; this.z = z; this.cycleDuration = cycleDuration; }; @Override public void fromBytes(ByteBuf buf) { dim = buf.readInt(); x = buf.readInt(); y = buf.readInt(); z = buf.readInt(); cycleDuration = buf.readInt(); }; @Override public void toBytes(ByteBuf buf) { buf.writeInt(dim); buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); buf.writeInt(cycleDuration); }; public static class Handler implements IMessageHandler<PacketPulserUpdate, PacketPulserUpdate> { public Handler() { }; private World getWorldByDim(int dim) { WorldServer[] worlds = MinecraftServer.getServer().worldServers; int i; for (i=0; i<worlds.length; i++) { World world = worlds[i]; if (world.provider.dimensionId == dim) { return world; }; }; return null; }; @Override public PacketPulserUpdate onMessage(PacketPulserUpdate packet, MessageContext ctx) { World world = getWorldByDim(packet.dim); if (world != null) { TileEntity te = world.getTileEntity(packet.x, packet.y, packet.z); if (te != null) { if (te instanceof TileEntityPulser) { TileEntityPulser pulser = (TileEntityPulser) te; pulser.cycleDuration = packet.cycleDuration; world.markBlockForUpdate(packet.x, packet.y, packet.z); }; }; } else { System.out.println("[MADDTECH] WARNING: Failed to find dimension for pulser update!"); }; return null; }; }; }; Code that sends the packet (this runs on the client side): public void sendUpdateToServer() { PacketPulserUpdate update = new PacketPulserUpdate(worldObj, xCoord, yCoord, zCoord, cycleDuration); LibTech.network.sendToServer(update); };
-
Unexplained crash when connected to server with my mod
Sorry, I misread your question. Yes, if both the server and the client have only my mod - and on other mods - installed, this error still happens. However, sometimes, instead of the crash, the client waits indefinitely for some kind of response (until a timeout), and the server logs nothing. More often though, that error occurs.
-
Unexplained crash when connected to server with my mod
Yes, removing my mod allows players to connect.
-
Unexplained crash when connected to server with my mod
Hello. I am working on a mod which has been going well most of the time, and I have a very strange problem which I can't seem to fix. Th problem went unnoticed until I tried creating a server with the mod. Everything works perfectly on singleplayer, but when i try to connect to a dedicated server, I get a strange error on the client: [12:50:02] [Client thread/INFO]: Connecting to localhost, 25565 [12:50:02] [Netty Client IO #1/INFO]: Server protocol version 1 [12:50:02] [Netty Client IO #1/INFO]: Attempting connection with missing mods [buildCraft|Builders, BuildCraft|Core, BuildCraft|Energy, BuildCraft|Factory, BuildCraft|Silicon, BuildCraft|Transport, craftguide] at SERVER [12:50:02] [Netty Client IO #1/ERROR]: NetworkDispatcher exception io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(11) + length(106601) exceeds writerIndex(41075): UnpooledHeapByteBuf(ridx: 11, widx: 41075, cap: 41075) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[byteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131) ~[byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [ReadTimeoutHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [AbstractNioByteChannel$NioByteUnsafe.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79] Caused by: java.lang.IndexOutOfBoundsException: readerIndex(11) + length(106601) exceeds writerIndex(41075): UnpooledHeapByteBuf(ridx: 11, widx: 41075, cap: 41075) at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?] at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:668) ~[AbstractByteBuf.class:?] at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:676) ~[AbstractByteBuf.class:?] at net.minecraft.network.PacketBuffer.readBytes(SourceFile:581) ~[et.class:?] at net.minecraft.network.play.server.S3FPacketCustomPayload.func_148837_a(S3FPacketCustomPayload.java:41) ~[gr.class:?] at net.minecraft.util.MessageDeserializer.decode(SourceFile:40) ~[ez.class:?] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232) ~[byteToMessageDecoder.class:?] ... 16 more [12:50:02] [Netty Client IO #1/ERROR]: NetworkDispatcher exception io.netty.handler.codec.DecoderException: java.io.IOException: Bad packet id 1394 at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[byteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:196) ~[byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:214) [byteToMessageDecoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75) [ChannelInboundHandlerAdapter.class:?] at io.netty.handler.timeout.ReadTimeoutHandler.channelInactive(ReadTimeoutHandler.java:143) [ReadTimeoutHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:767) [DefaultChannelPipeline.class:?] at io.netty.channel.AbstractChannel$AbstractUnsafe$5.run(AbstractChannel.java:558) [AbstractChannel$AbstractUnsafe$5.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79] Caused by: java.io.IOException: Bad packet id 1394 at net.minecraft.util.MessageDeserializer.decode(SourceFile:37) ~[ez.class:?] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232) ~[byteToMessageDecoder.class:?] ... 16 more The server side simply thinks that the player connects and then immediately leaves the game. By testing old alpha versions, I noticed that the problem occured between 0.9.2 and 0.9.4. Version 0.9.3 wouldn't run up on the server at all (it crashed at stratup), complaining about a missing class - this was fixed by moving a client-bound registerMessage() to the ClientProxy. The different between 0.9.2 and 0.9.4 was that the newer version creates a channel "maddtech" through which it sends a message to clients. However, even if I comment out all network-related code (preventing the messages from being registered or even sent), leaving only the newSimpleChannel() function, it still fails with this message. I don't even know which parts of the code are relevant to this. Does anyone have any clue? I can post code if needed, but I really don't know, at this point, which parts of the code you even need to see. NOTE: I see it reports missing mods. This is clearly not right; the server has only MaddTech (my mod) on it, and the client has BuildCraft, MaddTech and CraftGuide. The server reports no missing mods; just the client. It also says that the server protocol version is 1, but doing a "minecraft ping" (sending the query for server info), returns protocol version 5: {"players": {"max": 20, "online": 0}, "version": {"protocol": 5, "name": "1.7.10"}, "description": "A Minecraft Server", "modinfo": {"modList": [{"version": "9.05", "modid": "mcp"}, {"version": "7.10.18.1180", "modid": "FML"}, {"version": "10.13.0.1180", "modid": "Forge"}, {"version": "1.1.0", "modid": "maddtech"}], "type": "FML"}}
IPS spam blocked by CleanTalk.