Jump to content

[1.7.10] Packet Out Of Bounds Exception


starwarsmace

Recommended Posts

So Im sending a packet to the server. And then all of a sudden I get this error as soon as I send the packet...

 

io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more
[17:29:11] [server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more
[17:29:11] [server thread/ERROR] [FML]: There was a critical exception handling a packet on channel ChangeHealth
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more
[17:29:11] [server thread/ERROR] [FML]: FMLIndexedMessageCodec exception caught
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more
[17:29:11] [server thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more
[17:29:11] [server thread/ERROR] [FML]: There was a critical exception handling a packet on channel ChangeHealth
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.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.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.IndexOutOfBoundsException: index: 1, length: 57 (expected: range(0, 40))
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1128) ~[AbstractByteBuf.class:?]
at io.netty.buffer.SlicedByteBuf.nioBuffer(SlicedByteBuf.java:261) ~[slicedByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:953) ~[AbstractByteBuf.class:?]
at cpw.mods.fml.common.network.ByteBufUtils.readUTF8String(ByteBufUtils.java:119) ~[byteBufUtils.class:?]
at com.starwarsmace.healthbeam.ChangeHealth.fromBytes(ChangeHealth.java:33) ~[ChangeHealth.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?]
at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 13 more

 

What did I go out of bounds with? All I did was use ByteBufUtils.writeUTF8String and read it

 

My packet code:

 

public class ChangeHealth implements IMessage {
private String uuid;
public ChangeHealth(){}
public ChangeHealth(String uuid) {
	super();
	this.uuid=uuid;
}
public String getMessage(){
	return this.uuid;
}
@Override
public void toBytes(ByteBuf buf) {
	ByteBufUtils.writeUTF8String(buf, this.uuid);

}
@Override
public void fromBytes(ByteBuf buf) {

	this.uuid=ByteBufUtils.readUTF8String(buf);
}


public static class ChangeHealthHandler implements IMessageHandler<ChangeHealth, IMessage>{

	@SuppressWarnings("unchecked")
	@Override
	public IMessage onMessage(ChangeHealth message, MessageContext ctx) {
		String b = message.getMessage().split(":")[1];
		String uuid = message.getMessage().split(":")[0];
		EntityPlayer healer = null;
		for(EntityPlayer player : (List<EntityPlayer>)MinecraftServer.getServer().getConfigurationManager().playerEntityList){
			if(player.getUniqueID().toString()==uuid){
				healer=player;
				break;
			}
		}

		if(b=="add"){
			if(healer!=null){
				HealthBeamHandler.addHealer(healer);

			}else{
				return null;
			}
		}else{
			if(healer!=null){
				HealthBeamHandler.removeHealer(UUID.fromString(uuid));

			}else{
				return null;
			}
		}
		return null;
	}

}
}

 

Note: Used a nested class for the handler

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

Flaws of your code:

 

1. Separate Message and Handler to different classes. (Belive me, in some cases this saves you from very hard to notice bug).

 

2. Don't use UUID! Not only a waste of bytes sent, but just bad.

To send entity reference through packet you want to use entity ID.

On IMessage

entity.getEntityId();

And write it into buffer (int).

On receiver:

Entity e = world.getEntityByID(msg.entityId);

 

Also - send stuff like "add" in bytes (0, 1, 2 for example).

 

EDIT: Additional info:

As to sending string - pack it into NBT and send whole NBT.

ByteBufUtils.writeTag(buffer, NBTTag);

As to UUID - it is a 2x longs - you can UUID.getLeastSignificantBits() and .getMostSignificantBits(), you can write UUID to NBT or send as longs and recreate it on receiver.

 

Side note: NEVER use UUID for anything other than presistent data (HDD saves), unless you have to ofc. (attribute modifiers are example, which in my opinion are coded simply badly).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Flaws of your code:

 

1. Separate Message and Handler to different classes. (Belive me, in some cases this saves you from very hard to notice bug).

 

2. Don't use UUID! Not only a waste of bytes sent, but just bad.

To send entity reference through packet you want to use entity ID.

On IMessage

entity.getEntityId();

And write it into buffer (int).

On receiver:

Entity e = world.getEntityByID(msg.entityId);

 

Also - send stuff like "add" in bytes (0, 1, 2 for example).

 

EDIT: Additional info:

As to sending string - pack it into NBT and send whole NBT.

ByteBufUtils.writeTag(buffer, NBTTag);

As to UUID - it is a 2x longs - you can UUID.getLeastSignificantBits() and .getMostSignificantBits(), you can write UUID to NBT or send as longs and recreate it on receiver.

 

Side note: NEVER use UUID for anything other than presistent data (HDD saves), unless you have to ofc. (attribute modifiers are example, which in my opinion are coded simply badly).

1. Oh alright then.

 

2. Well I am using UUID because I am going to be having things being sent in from bukkit and into forge. Unless bukkit has some entity.getEntityId that I haven't noticed I was going to use UUID.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

If bukkit doesn't have IDs then you would have to make ("sending a packet to the server"): ClientMod---(send entityID)--->ServerForgeMod(read entity id)---(pass entity instance)--->Bukkit(operate).

 

And from what I remember bukkit doesn't have it because it is only server-sided, who would use those IDs?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

The UUID is not going to work, since the Client (afaik) does not know the UUID of an Entity. I don't know the bukkit API, but most likely it does not have an entityID method.

Actually, there is another packet that receives the packet from Bukkit and that packet passes almost the same message to this packet(which goes to the server).

 

Also, there is no forge to bukkit sending involved. Just bukkit to forge and forge to forge.

 

Also, does the crash have something to do with the UUID being long?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

First of all your packet code is horrible. Don't send things as Strings that aren't strings. Don't send things as one big String. Send individual data.

Also: You cannot compare Strings with ==, it will almost always be false.

 

The crash is probably because Forge packets have a packetID prepended (as a byte). You need to make sure to send that one from bukkit as well.

 

Bukkit to forge meaning server to client? Thats as I said not gonna work most likely, but I dont know the bukkit api very well. Unless they do have an EntityID getter you have to use proprietary methods and call into the net.minecraft packages.

 

I guess you are right about my packet code being horrible...

 

And that == with Strings happens when youre up coding at 2AM and have no idea what the heck youre doing. Otherwise Im done with those java noob mistakes :D

 

Second:

 

For now Im just checking whether my other code is working(the one on forge) so Im not using bukkit right now. Im just using an item to send that packet to test whether the other parts of my mods work...

 

Question:

So is the UUID's getLeastSignificantBits() the first 64 of the 128.

and the getMostSignificantBits is the second 64 of the 128?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

ok...

I think I figured out how to make the uuid into two longs and into an nbt.

 

public class ChangeHealth implements IMessage {
private UUID uuid;
private boolean add;
public ChangeHealth(){}
public ChangeHealth(UUID uuid,boolean add) {
	super();
	this.uuid=uuid;
	this.add = add;
}

@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound n = new NBTTagCompound();
	n.setLong("least", this.uuid.getLeastSignificantBits());
	n.setLong("most", this.uuid.getMostSignificantBits());
	n.setBoolean("add", this.add);
	ByteBufUtils.writeTag(buf, n);

}
@Override
public void fromBytes(ByteBuf buf) {

	NBTTagCompound n =ByteBufUtils.readTag(buf);
	this.uuid= new UUID(n.getLong("most"),n.getLong("least"));
	this.add=n.getBoolean("add");
}

}

 

Then in my code for the handler I do this:

 

@Override
	public IMessage onMessage(ChangeHealth message, MessageContext ctx) {
		EntityPlayer healer = null;
		for(EntityPlayer player : (List<EntityPlayer>)MinecraftServer.getServer().getConfigurationManager().playerEntityList){
			if(player.getUniqueID().equals(message.uuid)){
				healer=player;
				break;
			}
		}

		if(message.add){
			if(healer!=null){
				HealthBeamHandler.addHealer(healer);

			}else{
				return null;
			}
		}else{
			if(healer!=null){
				HealthBeamHandler.removeHealer(message.uuid);

			}else{
				return null;
			}
		}
		return null;
	}

 

I think that might work...

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

Jesus mercy...

Seriously?

 

Writing:

 

buf.writeLong(uuid.getLeastSignificantBits());
buf.writeLong(uuid.getMostSignificantBits());

 

Reading:

 

long lsb = buf.readLong(),
long msb = buf.readLong();
UUID uuid = new UUID(msb, lsb);

 

But as I said before: This will not work. The UUID is different on the client.

Jesus mercy...

Seriously?

 

Writing:

 

buf.writeLong(uuid.getLeastSignificantBits());
buf.writeLong(uuid.getMostSignificantBits());

 

Reading:

 

long lsb = buf.readLong(),
long msb = buf.readLong();
UUID uuid = new UUID(msb, lsb);

 

But as I said before: This will not work. The UUID is different on the client.

 

1. Following what Ernio was saying with the nbt...

EDIT: Additional info:

As to sending string - pack it into NBT and send whole NBT.

ByteBufUtils.writeTag(buffer, NBTTag);

As to UUID - it is a 2x longs - you can UUID.getLeastSignificantBits() and .getMostSignificantBits(), you can write UUID to NBT or send as longs and recreate it on receiver.

I mean he did say to do it for sending strings but... I thought it would apply to other things too

 

2. Im not working with the client currently. The client is just for receiving the bukkit message and passing it onto another packet which sends it to the forge server. So that UUID is fine.

 

3. Tested out my code and it worked... Though your writing and reading is probably more efficient.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

I mean he did say to do it for sending strings but... I thought it would apply to other things too

Not sure what Ernio was up to there. Don't send NBT in packets.

2. Im not working with the client currently. The client is just for receiving the bukkit message and passing it onto another packet which sends it to the forge server. So that UUID is fine.

If you are not working with the client, then what are you doing with packets? Packets go client to server or server to client. Nothing else.

3. Tested out my code and it worked... Though your writing and reading is probably more efficient.

I am very curious as to what the fuck you are doing to make that code work.

 

1. Alright then....

 

2.  I can't seem to have the forge server receive the packets from bukkit. I'm just using forge client as a way of receiving it.

 

3. What code?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

My humble explanation:

That NBT thingy was a total side-note (a fact that might be used). And:

"As to UUID - it is a 2x longs - you can UUID.getLeastSignificantBits() and .getMostSignificantBits(), you can write UUID to NBT or send as longs and recreate it on receiver."

 

That might have been confusing, I give you that. But yeah, sending NBT is rather a trick if you don't care about few extra symbols and you alredy have some NBT write/read methods. (e.g you encode NBT of IExtendedEntityProperties and read it on client using readNBT, or other example is simply sending ItemStack as NBT - which I think MC doeas itself). In this case - sure, write longs directly.

 

Note: I still have not a damn idea what are you after. :P

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

2.  I can't seem to have the forge server receive the packets from bukkit.
Of course not. The server cannot send packets to itself. Just call the methods in your Bukkit plugin directly, they are running on the same machine, in the same JVM.

How would I call the methods though? There is no communication going on between bukkit and forge right?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

No, there is not. But they still run on the same machine, in the same Java process. You can access one from the other just fine. Either use reflection or figure out a way to have your plugin code accessible to your forge code when building and vice versa.

Could using server commands and have them called in bukkit a good way?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

No...

Just call a method. Like any other method.

Well yes...

But instead of using reflection, I could call a server command that I made in forge on bukkit and then that calls whatever I need to call...

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

Not really the nicest of ways to be honest.

Not the nicest...

Not the best....

But it works :D

 

And the player can't run it because its a server command...

 

Edit: Another question: Would reflection really be better than this idea?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

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

    • DAFTAR & LOGIN TAYO4D   Slot gacor online adalah permainan yang menarik dan menghasilkan keuntungan untuk banyak pemain di seluruh dunia. Dalam artikel ini, kita akan membahas tentang cara memilih dan memainkan slot gacor online terbaik.
    • Tayo4D : Bandar Online Togel Dan Slot Terbesar Di Indonesia     Pemain taruhan Tayo4D yang berkualitas memerlukan platform yang aman, terpercaya, dan mudah digunakan. Dalam era teknologi ini, banyak situs online yang menawarkan layanan taruhan togel 4D, tetapi memilih yang tepat menjadi tuntas. Berikut adalah cara untuk membuat artikel yang membahas tentang situs online terpercaya untuk permainan taruhan togel 4D.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa OLXTOTO telah menetapkan standar baru dalam dunia perjudian dengan menjadi platform terbesar untuk pengalaman gaming yang penuh kemenangan dan kegacoran, sepanjang masa. Dengan fokus yang kuat pada menyediakan permainan yang menghadirkan kesenangan tanpa batas dan peluang kemenangan besar, OLXTOTO telah menjadi pilihan utama bagi para pencinta judi berani di Indonesia. Maxwin: Mengejar Kemenangan Terbesar Maxwin bukan sekadar kata-kata kosong di OLXTOTO. Ini adalah konsep yang ditanamkan dalam setiap aspek permainan yang mereka tawarkan. Dari permainan slot yang menghadirkan jackpot besar hingga berbagai opsi permainan togel dengan hadiah fantastis, para pemain dapat memperoleh peluang nyata untuk mencapai kemenangan terbesar dalam setiap taruhan yang mereka lakukan. OLXTOTO tidak hanya menawarkan kesempatan untuk menang, tetapi juga menjadi wadah bagi para pemain untuk meraih impian mereka dalam perjudian yang berani. Gacor: Keberuntungan yang Tak Tertandingi Keberuntungan seringkali menjadi faktor penting dalam perjudian, dan OLXTOTO memahami betul akan hal ini. Dengan berbagai strategi dan analisis yang disediakan, pemain dapat menemukan peluang gacor yang tidak tertandingi dalam setiap taruhan. Dari hasil togel yang tepat hingga putaran slot yang menguntungkan, OLXTOTO memastikan bahwa setiap taruhan memiliki potensi untuk menjadi momen yang mengubah hidup. Inovasi dan Kualitas Tanpa Batas Tidak puas dengan prestasi masa lalu, OLXTOTO terus berinovasi untuk memberikan pengalaman gaming terbaik kepada para pengguna. Dengan menggabungkan teknologi terbaru dengan desain yang ramah pengguna, platform ini menyajikan antarmuka yang mudah digunakan tanpa mengorbankan kualitas. Setiap pembaruan dan peningkatan dilakukan dengan tujuan tunggal: memberikan pengalaman gaming yang tanpa kompromi kepada setiap pengguna. Komitmen Terhadap Kepuasan Pelanggan Di balik kesuksesan OLXTOTO adalah komitmen mereka terhadap kepuasan pelanggan. Tim dukungan pelanggan yang profesional siap membantu para pemain dalam setiap langkah perjalanan gaming mereka. Dari pertanyaan teknis hingga bantuan dengan transaksi keuangan, OLXTOTO selalu siap memberikan pelayanan terbaik kepada para pengguna mereka. Penutup: Mengukir Sejarah dalam Dunia Perjudian Daring OLXTOTO bukan sekadar platform perjudian berani biasa. Ini adalah ikon dalam dunia perjudian daring Indonesia, sebuah destinasi yang menyatukan kemenangan dan keberuntungan dalam satu tempat yang mengasyikkan. Dengan komitmen mereka terhadap kualitas, inovasi, dan kepuasan pelanggan, OLXTOTO terus mengukir sejarah dalam perjudian dunia berani, menjadi nama yang tak terpisahkan dari pengalaman gaming terbaik. Bersiaplah untuk mengalami sensasi kemenangan terbesar dan keberuntungan tak terduga di OLXTOTO - platform maxwin dan gacor terbesar sepanjang masa.
    • OLXTOTO - Bandar Togel Online Dan Slot Terbesar Di Indonesia OLXTOTO telah lama dikenal sebagai salah satu bandar online terkemuka di Indonesia, terutama dalam pasar togel dan slot. Dengan reputasi yang solid dan pengalaman bertahun-tahun, OLXTOTO menawarkan platform yang aman dan andal bagi para penggemar perjudian daring. DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI Beragam Permainan Togel Sebagai bandar online terbesar di Indonesia, OLXTOTO menawarkan berbagai macam permainan togel. Mulai dari togel Singapura, togel Hongkong, hingga togel Sidney, pemain memiliki banyak pilihan untuk mencoba keberuntungan mereka. Dengan sistem yang transparan dan hasil yang adil, OLXTOTO memastikan bahwa setiap taruhan diproses dengan cepat dan tanpa keadaan. Slot Online Berkualitas Selain togel, OLXTOTO juga menawarkan berbagai permainan slot online yang menarik. Dari slot klasik hingga slot video modern, pemain dapat menemukan berbagai opsi permainan yang sesuai dengan preferensi mereka. Dengan grafis yang memukau dan fitur bonus yang menggiurkan, pengalaman bermain slot di OLXTOTO tidak akan pernah membosankan. Keamanan dan Kepuasan Pelanggan Terjamin Keamanan dan kepuasan pelanggan merupakan prioritas utama di OLXTOTO. Mereka menggunakan teknologi enkripsi terbaru untuk melindungi data pribadi dan keuangan para pemain. Tim dukungan pelanggan yang ramah dan responsif siap membantu pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Promosi dan Bonus Menarik OLXTOTO sering menawarkan promosi dan bonus menarik kepada para pemainnya. Mulai dari bonus selamat datang hingga bonus deposit, pemain memiliki kesempatan untuk meningkatkan kemenangan mereka dengan memanfaatkan berbagai penawaran yang tersedia. Penutup Dengan reputasi yang solid, beragam permainan berkualitas, dan komitmen terhadap keamanan dan kepuasan pelanggan, OLXTOTO tetap menjadi salah satu pilihan utama bagi para pecinta judi online di Indonesia. Jika Anda mencari pengalaman berjudi yang menyenangkan dan terpercaya, OLXTOTO layak dipertimbangkan.
    • I have been having a problem with minecraft forge. Any version. Everytime I try to launch it it always comes back with error code 1. I have tried launching from curseforge, from the minecraft launcher. I have also tried resetting my computer to see if that would help. It works on my other computer but that one is too old to run it properly. I have tried with and without mods aswell. Fabric works, optifine works, and MultiMC works aswell but i want to use forge. If you can help with this issue please DM on discord my # is Haole_Dawg#6676
  • Topics

×
×
  • Create New...

Important Information

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