kumpelblase2 / Remote-Entities

A library that enables you to control entities in minecraft.
Other
31 stars 28 forks source link

Creating human entity w/ movement desires generates serialization exception #43

Closed kolinkrewinkel closed 11 years ago

kolinkrewinkel commented 11 years ago

Adding any movement desire (including the default: swim, or look at nearest or look randomly) generate this:

java.lang.IllegalArgumentException: class net.minecraft.server.v1_5_R2.EntityItemFrame declares multiple JSON fields named e
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:122)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ArrayTypeAdapter$1.create(ArrayTypeAdapter.java:48)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.getAdapter(Gson.java:353)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:200)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:200)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:200)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.toJson(Gson.java:546)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.toJson(Gson.java:525)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.toJson(Gson.java:480)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.libs.com.google.gson.Gson.toJson(Gson.java:460)
17:52:16 [SEVERE]   at de.kumpelblase2.remoteentities.persistence.serializers.JSONSerializer.save(JSONSerializer.java:31)
17:52:16 [SEVERE]   at de.kumpelblase2.remoteentities.EntityManager.saveEntities(EntityManager.java:521)
17:52:16 [SEVERE]   at com.kolinkrewinkel.BitLimitNPCs.NPCCommandExecutor.createNPCWithArguments(NPCCommandExecutor.java:132)
17:52:16 [SEVERE]   at com.kolinkrewinkel.BitLimitNPCs.NPCCommandExecutor.onCommand(NPCCommandExecutor.java:60)
17:52:16 [SEVERE]   at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
17:52:16 [SEVERE]   at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
17:52:16 [SEVERE]   at org.bukkit.craftbukkit.v1_5_R2.CraftServer.dispatchCommand(CraftServer.java:523)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.PlayerConnection.handleCommand(PlayerConnection.java:966)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.PlayerConnection.chat(PlayerConnection.java:884)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.PlayerConnection.a(PlayerConnection.java:841)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.Packet3Chat.handle(Packet3Chat.java:44)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.NetworkManager.b(NetworkManager.java:292)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.PlayerConnection.d(PlayerConnection.java:110)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.ServerConnection.b(SourceFile:35)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.DedicatedServerConnection.b(SourceFile:30)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:580)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.DedicatedServer.r(DedicatedServer.java:225)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.MinecraftServer.q(MinecraftServer.java:476)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:409)
17:52:16 [SEVERE]   at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)

Any ideas?

kolinkrewinkel commented 11 years ago

Err... I know why. (duplication of "e" between EntityItemFrame and EntityHanging, its parent). The real question is: how do we fix it?

kumpelblase2 commented 11 years ago

Well either don't serialize it when you don't really need it or serialize it manually in the ObjectParser.

kumpelblase2 commented 11 years ago

You can, in fact, create your own object parser and let remote entities use that one. Do do that just do EntityData.objectParser = new _yourparser(); and you're done :)

kolinkrewinkel commented 11 years ago

How would I get around parsing this in a situation where it's the human entity which is failing to be serialized? I don't understand the relationship between movement desires and the item frame.

kumpelblase2 commented 11 years ago

Hm.... if it's a human entity that fails, then it's interesting as it should get parsed fine using the unique id. Is it one of the preset desires or is it one of your own?

kolinkrewinkel commented 11 years ago

Both will do it.

Sent from my iPhone

On Apr 21, 2013, at 12:24, kumpelblase2 notifications@github.com wrote:

Hm.... if it's a human entity that fails, then it's interesting as it should get parsed fine using the unique id. Is it one of the preset desires or is it one of your own?

— Reply to this email directly or view it on GitHub.

kumpelblase2 commented 11 years ago

I will continue working on it in the next days, there's no quick solution for it.

kolinkrewinkel commented 11 years ago

Cool, thank you. I honestly have no idea. :)

On Apr 21, 2013, at 1:32 PM, kumpelblase2 notifications@github.com wrote:

I will continue working on it in the next days, there's no quick solution for it.

— Reply to this email directly or view it on GitHub.

kumpelblase2 commented 11 years ago

Well the issue is that I didn't treated json as I treated yml. In this case I told yml to not save the whole entity but just its unique id (using the serialize() method). I didn't do such thing for json and thus it tries to save the COMPLETE entity object with all its values and it then fails.

kolinkrewinkel commented 11 years ago

Does this mean the YML serializer will succeed? If so, I'd have no objections to switching (in fact, it'd be more conformist to the way most of the other plugins in use on the target server persist data).

On Apr 21, 2013, at 1:42 PM, kumpelblase2 notifications@github.com wrote:

Well the issue is that I didn't treated json as I treated yml. In this case I told yml to not save the whole entity but just its unique id (using the serialize() method). I didn't do such thing for json and thus it tries to save the COMPLETE entity object with all its values and it then fails.

— Reply to this email directly or view it on GitHub.

kumpelblase2 commented 11 years ago

I had no issues yet with yml at all. In fact, I only tested most of the stuff with yml only and expected json to work just the same which was a completely wrong assumption from me as you can see.

kumpelblase2 commented 11 years ago

This should now be fixed. Can you you confirm that? https://github.com/kumpelblase2/Remote-Entities/commit/ed56ae8b0be9619ad488c845d4807bb865acece4 (note: you'll need to compile it yourself as it's on a separate branch.)

kolinkrewinkel commented 11 years ago

Worked in my usage. Thanks. :)

On May 6, 2013, at 1:01 AM, kumpelblase2 notifications@github.com wrote:

This should now be fixed. Can you you confirm that? ed56ae8

— Reply to this email directly or view it on GitHub.