Jump to content

Recommended Posts

Posted

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"}}

Posted

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.

Posted

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);
};

Posted

I think you have to call

registerMessage

method on both sides, always. That may be wrong, but I think I have read that somewhere on this forum.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

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.

Posted

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).

Posted

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)

Posted

What version of Forge are you using? I didn't see that information anywhere in your post, and it could be very important.

 

To continue troubleshooting, I think your best bet is probably to remove all mods but yours, see if you can reproduce the issue, then remove ALL of your network code and see if it still happens. If so, remove the Nuke entity and try again. This should give you a rough idea of where the problem is.

 

If you are using Git, you can run 'git diff' against the earlier version to see everything that has changed since then and perhaps get more clues as to the cause.

Posted

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??

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi! I'm trying to add my custom models/textures renderer like this: public class PonyPlayerWrapperRenderer extends EntityRenderer<Player> { // wrapper class under my LivingEntityRenderer class implementation private final PonyPlayerRenderer innerRenderer; private final PonyPlayerRenderer innerSlimRenderer; public PonyPlayerWrapperRenderer(final EntityRendererProvider.Context context) { super(context); System.out.println("creating new PonyPlayerWrapperRenderer"); this.innerRenderer = new PonyPlayerRenderer(context, false); this.innerSlimRenderer = new PonyPlayerRenderer(context, true); } @Override public void render(final Player entity, final float yaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource bufferSource, final int packedLight) { System.out.println("PonyPlayerWrapperRenderer render: " + entity.toString()); if (entity instanceof AbstractClientPlayer clientPlayer) { if (clientPlayer.getModelName().contains("slim")) { innerSlimRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } else { innerRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } } } @Override public ResourceLocation getTextureLocation(final Player player) { System.out.println("PonyPlayerWrapperRenderer getTextureLocation"); if (player instanceof AbstractClientPlayer clientPlayer) { return clientPlayer.getSkinTextureLocation(); } System.out.println("player instanceof AbstractClientPlayer is false"); return getDefaultSkin(player.getUUID()); } } public class PonyPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> { private final PlayerModel<AbstractClientPlayer> earthModel; private final PlayerModel<AbstractClientPlayer> pegasusModel; private final PlayerModel<AbstractClientPlayer> unicornModel; public PonyPlayerRenderer(final EntityRendererProvider.Context context, final boolean slim) { super( context, slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)), 0.5f ); System.out.println("creating new PonyPlayerRenderer"); this.earthModel = slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); this.pegasusModel = new PegasusModel(context.bakeLayer(PegasusModel.LAYER_LOCATION)); this.unicornModel = new UnicornModel(context.bakeLayer(UnicornModel.LAYER_LOCATION)); } @Override public void render(final AbstractClientPlayer player, final float entityYaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource buffer, final int packedLight) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); this.model = switch (race) { case PEGASUS -> pegasusModel; case UNICORN -> unicornModel; case EARTH -> earthModel; }; super.render(player, entityYaw, partialTicks, poseStack, buffer, packedLight); } @Override public ResourceLocation getTextureLocation(final AbstractClientPlayer player) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); return switch (race) { case EARTH -> fromNamespaceAndPath(MODID, "textures/entity/earth_pony.png"); case PEGASUS -> fromNamespaceAndPath(MODID, "textures/entity/pegasus.png"); case UNICORN -> fromNamespaceAndPath(MODID, "textures/entity/unicorn.png"); }; } } @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { // mod bus render registration config @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onRegisterRenderers(final EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(EntityType.PLAYER, PonyPlayerWrapperRenderer::new); System.out.println("onRegisterRenderers end"); } } Method onRegisterRenderers() is called and I can see it being logged. But when I enter the world, my PonyWrapperRenderer render() method doesn't ever seem to be called. I also tried to put my renderer to EntityRenderDispatcher's playerRenderers via reflection: @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent event) { event.enqueueWork(() -> { try { final EntityRenderDispatcher dispatcher = Minecraft.getInstance().getEntityRenderDispatcher(); final Field renderersField = getEntityRenderDispatcherField("playerRenderers"); final Field itemInHandRenderer = getEntityRenderDispatcherField("itemInHandRenderer"); @SuppressWarnings("unchecked") final Map<String, EntityRenderer<? extends Player>> playerRenderers = (Map<String, EntityRenderer<? extends Player>>)renderersField.get(dispatcher); final PonyPlayerWrapperRenderer renderer = new PonyPlayerWrapperRenderer( new EntityRendererProvider.Context( dispatcher, Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getBlockRenderer(), (ItemInHandRenderer)itemInHandRenderer.get(dispatcher), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font ) ); playerRenderers.put("default", renderer); playerRenderers.put("slim", renderer); System.out.println("Player renderers replaced"); } catch (final Exception e) { throw new RuntimeException("Failed to replace player renderers", e); } }); } private static Field getEntityRenderDispatcherField(final String fieldName) throws NoSuchFieldException { final Field field = EntityRenderDispatcher.class.getDeclaredField(fieldName); field.setAccessible(true); return field; } } But I receive the error before Minecraft Client appears (RuntimeException: Failed to replace player renderers - from ClientRenderers onClientSetup() method - and its cause below): java.lang.IllegalArgumentException: No model for layer anotherlittlepony:earth_pony#main at net.minecraft.client.model.geom.EntityModelSet.bakeLayer(EntityModelSet.java:18) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRendererProvider$Context.bakeLayer(EntityRendererProvider.java:69) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerRenderer.<init>(PonyPlayerRenderer.java:32) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerWrapperRenderer.<init>(PonyPlayerWrapperRenderer.java:24) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.ClientRenderers.lambda$onClientSetup$0(ClientRenderers.java:79) ~[main/:?] {re:classloading} ... 33 more Problem appears when EntityRendererProvider context tries to bakeLayer with my model layer location: new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); // PonyPlayerRenderer.java:32 public class PonyModel extends PlayerModel<AbstractClientPlayer> { // the model class itself public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation( ResourceLocation.fromNamespaceAndPath(MODID, "earth_pony"), "main" ); public PonyModel(final ModelPart root) { super(root, false); } public static LayerDefinition createBodyLayer() { // some CubeListBuilder stuff for model appearance } } Textures PNGs are placed at: resources/assets/[my mod id]/textures/entity. My forge version is 1.20.1. Would appreciate any help.
    • Well, a bit more information about what you're trying to do would be helpful. e.g. why you're trying to use "INVOKE_ASSIGN" instead of "INVOKE". "INVOKE_ASSIGN" calls your code after the "target" is called and its value is stored, if applicable. "INVOKE" calls your code before the target is called. "target" expects a fully qualified name, as per the SpongePowered docs, if that name is going to be remapped (which it will be if your injecting into Minecraft itself and not another mod). For more information on fully qualified names versus canonical names, see the Java specifications. Here's an example of a working "@At" from my own code that targets the "getClosestsVulnerablePlayerToEntity" call inside a mob's logic: @At(value = "INVOKE_ASSIGN", target = "net.minecraft.world.World.getClosestVulnerablePlayerToEntity(Lnet/minecraft/entity/Entity;D)Lnet/minecraft/entity/player/EntityPlayer;") Hope this helps!
    • Ran it one more time just to check, and there's no errors this time on the log??? Log : https://mclo.gs/LnuaAiu I tried allocating more memory to the modpack, around 8000MB and it's still the same; stopping at "LOAD_REGISTRIES". Are some of the mods clashing, maybe? I have no clue what to do LOL
    • Tried removing some biome generation mods and test ran it again, but it's still the same; still not responding as soon as it gets to "LOAD_REGISTRIES". This time with more errors though. Log : https://mclo.gs/uygZzD8 Is there too little memory allocated to the modpack maybe? Can someone help please.    (T.T)💔
    • This is sad. Over 3300 people have checked the thread and no one is able to help or give any ideas :(.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.