TeleportUtils.teleport conflicts with BetterPortals
Johni0702 opened this issue ยท 0 comments
1.12.2
Johni0702/BetterPortals#428
[22:45:22] [Server thread/ERROR] [dimdoors]: Teleporting failed with the following exception:
java.lang.IllegalStateException: Third-party transfer but not all views have been disposed of!
at de.johni0702.minecraft.view.impl.server.ServerWorldsManagerImpl.updateActiveViews(ServerWorldsManagerImpl.kt:70) ~[ServerWorldsManagerImpl.class:?]
at net.minecraft.server.management.PlayerChunkMap.handler$addPlayerWithViews$zzc000(SourceFile:549) ~[ou.class:?]
at net.minecraft.server.management.PlayerChunkMap.func_72683_a(SourceFile) ~[ou.class:?]
at net.minecraft.server.management.PlayerList.func_72375_a(PlayerList.java:290) ~[pl.class:?]
at org.dimdev.ddutils.TeleportUtils.teleport(TeleportUtils.java:216) ~[TeleportUtils.class:?]
at org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift.receiveEntity(TileEntityEntranceRift.java:84) ~[TileEntityEntranceRift.class:?]
at org.dimdev.dimdoors.shared.tileentities.TileEntityRift.teleport(TileEntityRift.java:190) [TileEntityRift.class:?]
at org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift.teleport(TileEntityEntranceRift.java:70) [TileEntityEntranceRift.class:?]
at org.dimdev.dimdoors.shared.blocks.BlockDimensionalDoor.func_180634_a(BlockDimensionalDoor.java:48) [BlockDimensionalDoor.class:?]
at net.minecraft.entity.Entity.func_145775_I(Entity.java:1044) [vg.class:?]
at net.minecraft.entity.Entity.func_70091_d(Entity.java:964) [vg.class:?]
at micdoodle8.mods.galacticraft.core.entities.player.GCEntityPlayerMP.func_70091_d(GCEntityPlayerMP.java:54) [GCEntityPlayerMP.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147347_a(NetHandlerPlayServer.java:545) [pa.class:?]
at net.minecraft.network.play.client.CPacketPlayer.func_148833_a(SourceFile:126) [lk.class:?]
at net.minecraft.network.play.client.CPacketPlayer$Position.func_148833_a(SourceFile:57) [lk$a.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_212]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_212]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.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(Thread.java:748) [?:1.8.0_212]
BP has a hook into PlayerList.transferPlayerToDimension
right before the Respawn packet is sent, to allow it to tear down the world views it manages before the client switches the main world.
The different-world-EntityPlayerMP code path of TeleportUtils.teleport
duplicates the code in PlayerList.transferPlayerToDimension
instead of just calling it. Based on the comments, it looks like this was written before Forge added the ITeleporter
argument to transferPlayerToDimension
which would do the job as well (and in a more compatible and significantly simpler way).
This isn't even just a BP-specific issue, by duplicating the transferPlayerToDimension
code, one can easily introduce subtle bugs when they get out of sync: Either because a mod like BP modifies it at runtime, or just due to oversight during updates (e.g. notice that teleport
never sends any SPacketEntityProperties
, whereas transferPlayerToDimension
does; a few of the comments are outdated as well).