mirror of
https://github.com/GTNewHorizons/ForgeRelocation.git
synced 2026-10-26 14:23:52 +00:00
Try a thread safe client map, and guard against a null world (#6)
This commit is contained in:
1 parent
6820516d89
commit
ebc1762cb6
1 file changed
+7
-4
@@ -17,17 +17,18 @@ import net.minecraft.client.Minecraft
|
||||
import net.minecraft.init.Blocks
|
||||
import net.minecraft.world.{ChunkCoordIntPair, World}
|
||||
import net.minecraftforge.common.DimensionManager
|
||||
|
||||
import scala.collection.concurrent.TrieMap
|
||||
import scala.collection.mutable.{
|
||||
HashMap => MHashMap,
|
||||
MultiMap => MMultiMap,
|
||||
Set => MSet
|
||||
}
|
||||
|
||||
import scala.ref.WeakReference
|
||||
|
||||
object MovementManager2 {
|
||||
val serverRelocations = MHashMap[Int, WorldStructs]()
|
||||
val clientRelocations = MHashMap[Int, WorldStructs]()
|
||||
val clientRelocations = TrieMap[Int, WorldStructs]()
|
||||
|
||||
def relocationMap(isClient: Boolean) =
|
||||
if (isClient) clientRelocations else serverRelocations
|
||||
@@ -106,8 +107,10 @@ object MovementManager2 {
|
||||
RelocationSPH.forceSendData()
|
||||
}
|
||||
|
||||
def isMoving(w: World, x: Int, y: Int, z: Int) =
|
||||
getWorldStructs(w).contains(x, y, z)
|
||||
def isMoving(w: World, x: Int, y: Int, z: Int) = {
|
||||
if (w == null) false
|
||||
else getWorldStructs(w).contains(x, y, z)
|
||||
}
|
||||
|
||||
def addStructToWorld(w: World, b: BlockStruct) {
|
||||
getWorldStructs(w).addStruct(b)
|
||||
|
||||
Reference in new issue
Block a user