That is how I have my Packet infrastructure set up, not really the bug though.
public class Packet {
public static class Packet1 {
// ...
}
public static class Packet2 {
// ...
}
}
and I register via
Kryo Serializer = client.getKryo();
Serializer.register(Packet.Packet1.class);
Serializer.register(Packet.Packet2.class);
My issue comes about from code inside one of my packets. I have an object, Player, which has always been able to exist as a local variable of Packet1 (lets say)
public class Packet {
public static class Packet1 {
Player p = new Player();
// not shown: get & set function for object p
}
Recently I have added another object, which exists in Player
public class Player() {
Spell s = new Spell();
// not shown: get & set function for object s and initialization steps
}
Inside Spell:
public class Spell implements DrawableObject {
public Animation animation = null; // object from: org.newdawn.slick.Animation
public SpriteSheet sprite_sheet = null; // object from: org.newdawn.slick.SpriteSheet
// not shown: get & set function for objects and initialization steps
}
Here is the full trace:
Exception in thread "Client" com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 7709
Serialization trace:
animation (spells.Spell)
MySpells (client_framework.Player)
p1 (client_framework.Team)
Team1 (client_framework.GameLobby)
G (client_framework.Packet$Packet2PlayerInit)
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:623)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:747)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:340)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:293)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:671)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:224)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:760)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:340)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:293)
at com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:732)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:229)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:671)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:224)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:671)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:224)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:671)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:224)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:760)
at com.esotericsoftware.kryonet.KryoSerialization.read(KryoSerialization.java:57)
at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:137)
at com.esotericsoftware.kryonet.Client.update(Client.java:239)
at com.esotericsoftware.kryonet.Client.run(Client.java:317)
at java.lang.Thread.run(Unknown Source)
The compiler gets hung up at the variable ‘animation’ located in Spell.java due to it being incorrectly registered (or something along those lines).
I thought what agentd said, yet for whatever reason I don’t know how to find the accurate path in registering Animation.Frame
This is not recognized:
Serializer.register(org.newdawn.slick.Animation.Frame.class); // illegal, does not exist?
Thank you for your time.