I’m trying to save an armorstand entity and then duplicating it somewhere else. To achieve that, I’m saving an EntitySnapshot. Then, when executing the paste command, it get a copy of the snapshot and restore it and then spawn the entity on the player’s location.
I keep getting some type of entity tracking error :
[15:38:56] [Server thread/INFO] [nucleus]: COWLISSE ran the command: /astcopy
[15:39:01] [Server thread/INFO] [nucleus]: COWLISSE ran the command: /astpaste
[15:39:01] [Server thread/ERROR] [minecraft/EntityTracker]: "Silently" catching entity tracking error.
net.minecraft.util.ReportedException: Adding entity to track
at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java:256) [ol.class:?]
at net.minecraft.entity.EntityTracker.func_72786_a(EntityTracker.java:193) [ol.class:?]
at net.minecraft.world.ServerWorldEventHandler.func_72703_a(ServerWorldEventHandler.java:37) [op.class:?]
at net.minecraft.world.World.func_72923_a(World.java:1222) [amu.class:?]
at net.minecraft.world.WorldServer.func_72923_a(WorldServer.java:1112) [oo.class:?]
at net.minecraft.world.WorldServer.impl$forceSpawnEntity(WorldServer.java:4887) [oo.class:?]
at net.minecraft.world.WorldServer.bridge$forceSpawnEntity(WorldServer.java:4867) [oo.class:?]
at org.spongepowered.common.entity.EntityUtil.processEntitySpawn(EntityUtil.java:744) [EntityUtil.class:1.12.2-2838-7.2.2-RC0]
at org.spongepowered.common.event.tracking.PhaseTracker.spawnEntityWithCause(PhaseTracker.java:1155) [spongeforge-1.12.2-2838-7.2.2-RC0.jar:1.12.2-2838-7.2.2-RC0]
at net.minecraft.world.WorldServer.spawnEntity(WorldServer.java:1838) [oo.class:?]
at ca.coulis.armorstandcopy.AstPaste.execute(AstPaste.java:41) [AstPaste.class:?]
at org.spongepowered.api.command.spec.CommandSpec.process(CommandSpec.java:388) [CommandSpec.class:1.12.2-2838-7.2.2-RC0]
at org.spongepowered.common.command.SpongeCommandDispatcher.process(SpongeCommandDispatcher.java:355) [SpongeCommandDispatcher.class:1.12.2-2838-7.2.2-RC0]
at org.spongepowered.common.command.SpongeCommandManager.process(SpongeCommandManager.java:360) [SpongeCommandManager.class:1.12.2-2838-7.2.2-RC0]
at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:665) [dh.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:962) [pa.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:941) [pa.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?]
at org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:219) [PacketPhaseUtil.class:1.12.2-2838-7.2.2-RC0]
at net.minecraft.network.PacketThreadUtil$1.redirect$zla000$impl$redirectToPhaseTracker(SourceFile:540) [hv$1.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_261]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_261]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
at org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:308) [SpongeImplHooks.class:1.12.2-2838-7.2.2-RC0]
at net.minecraft.server.MinecraftServer.redirect$zje000$onRun(MinecraftServer.java:4682) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]
Caused by: java.lang.IllegalStateException: Entity EntityArmorStand['George'/186, l='world', x=62.92, y=66.00, z=229.14] is already tracked for world: world
at net.minecraft.entity.EntityTracker.redirect$zeg000$impl$reportEntityAlreadyTrackedWithWorld(EntityTracker.java:1063) ~[ol.class:?]
at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java:224) ~[ol.class:?]
... 31 more
I have tried spawning the entity and specifying the cause of spawn as documented in the docs but I still get the same error.