I’m getting an Exception I’ve not got before, after I added another type of Message (simply a class for me):
[icode]
Exception in thread “LWJGL Application” java.lang.IllegalArgumentException: Field not declared as byte: 0
at org.matheusdev.ror.net.packages.CreateEntityFieldAccess.getByte(Unknown Source)
at com.esotericsoftware.kryo.serializers.FieldSerializer$ByteField.write(FieldSerializer.java:403)
at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:213)
at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:571)
at com.esotericsoftware.kryonet.KryoSerialization.write(KryoSerialization.java:50)
at com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:192)
at com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:59)
…
[/icode]
But what does that mean?
In my game all Messages extend one class [icode]NetPackage[/icode]. I’ve changed it to include some info like that:
public abstract class NetPackage {
+ public static final byte TCP = 1;
+ public static final byte UDP = 2;
public long time = 0;
+ public byte type = 0;
public NetPackage() {
}
public NetPackage(long time, byte type) {
this.time = time;
+ this.type = type;
}
}
Now I get that exception (which says nothing useful to me, btw), and I don’t know why. I simply sent a subclass of NetPackage (both classes are registered, I checked it) over TCP to the Localhost on a port which worked all the time before…
What’s wrong?