mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-10-26 14:24:01 +00:00
sa
This commit is contained in:
3 files changed
+10
-2
No files matched your search
@@ -41,6 +41,7 @@ object MultipartHelper {
|
||||
if (!tag.getString("id").equals("savedMultipart"))
|
||||
return null
|
||||
|
||||
MultipartSaveLoad.loadingWorld = world
|
||||
return TileMultipart.createFromNBT(tag)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,11 @@ object MultipartEventHandler {
|
||||
@SubscribeEvent
|
||||
def worldUnLoad(event: WorldEvent.Unload) {
|
||||
MultipartSPH.onWorldUnload(event.world)
|
||||
if (event.world.isRemote)
|
||||
if (event.world.isRemote) {
|
||||
TileCache.clear()
|
||||
} else {
|
||||
MultipartSaveLoad.loadingWorld = null
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -7,13 +7,16 @@ import net.minecraft.world.chunk.Chunk
|
||||
import net.minecraft.world.ChunkPosition
|
||||
import codechicken.multipart.{MultipartHelper, TileMultipart}
|
||||
import codechicken.lib.asm.ObfMapping
|
||||
import net.minecraft.world.World
|
||||
import scala.collection.mutable
|
||||
import codechicken.multipart.MultipartHelper.IPartTileConverter
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
/** Hack due to lack of TileEntityLoadEvent in forge */
|
||||
/** Hack due to lack of TileEntityLoadEvent in forge
|
||||
*/
|
||||
object MultipartSaveLoad {
|
||||
val converters = mutable.MutableList[IPartTileConverter[_]]()
|
||||
var loadingWorld: World = _
|
||||
|
||||
class TileNBTContainer extends TileEntity {
|
||||
var tag: NBTTagCompound = _
|
||||
@@ -56,6 +59,7 @@ object MultipartSaveLoad {
|
||||
}
|
||||
|
||||
def loadTiles(chunk: Chunk) {
|
||||
loadingWorld = chunk.worldObj
|
||||
val iterator = chunk.chunkTileEntityMap
|
||||
.asInstanceOf[Map[ChunkPosition, TileEntity]]
|
||||
.entrySet
|
||||
|
||||
Reference in new issue
Block a user