mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 15:03:18 +00:00
Fix dimension change
This commit is contained in:
1 parent
92dec60858
commit
58046590c0
2 files changed
+22
No files matched your search
@@ -70,6 +70,11 @@ object MultipartEventHandler {
|
||||
MultipartSPH.onPlayerLogout(event.player)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
def playerChangedDimension(event: PlayerEvent.PlayerChangedDimensionEvent) {
|
||||
MultipartSPH.onPlayerChangedDimension(event.player, event.fromDim)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
def serverTick(event: TickEvent.ServerTickEvent) {
|
||||
if (event.phase == TickEvent.Phase.END)
|
||||
|
||||
@@ -322,6 +322,23 @@ object MultipartSPH
|
||||
case _ =>
|
||||
}
|
||||
|
||||
def onPlayerChangedDimension(p: EntityPlayer, fromDimension: Int) = p match {
|
||||
case mp: EntityPlayerMP =>
|
||||
for (map <- Seq(chunkWatchers, newWatchers)) {
|
||||
for (
|
||||
(world, watchers) <- map.toSeq
|
||||
if WorldContextRegistry
|
||||
.getHostWorld(world)
|
||||
.provider
|
||||
.dimensionId == fromDimension
|
||||
) {
|
||||
watchers.remove(mp)
|
||||
if (watchers.isEmpty) map.remove(world)
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
|
||||
def getDescPacket(chunk: Chunk, it: Iterator[TileEntity]): PacketCustom = {
|
||||
val s = new MCByteStream(new ByteArrayOutputStream)
|
||||
|
||||
|
||||
Reference in new issue
Block a user