mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Oh great, so now onChunkUnload is called before writeToNBT again .-.
Could guys *please* decide on one?
This commit is contained in:
parent
823b938ee5
commit
c30b3c09ef
@ -1,7 +1,5 @@
|
|||||||
package li.cil.oc.common.tileentity.traits
|
package li.cil.oc.common.tileentity.traits
|
||||||
|
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
import li.cil.oc.OpenComputers
|
import li.cil.oc.OpenComputers
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
import li.cil.oc.client.Sound
|
import li.cil.oc.client.Sound
|
||||||
@ -20,8 +18,6 @@ import net.minecraftforge.fml.relauncher.SideOnly
|
|||||||
trait TileEntity extends net.minecraft.tileentity.TileEntity {
|
trait TileEntity extends net.minecraft.tileentity.TileEntity {
|
||||||
private final val IsServerDataTag = Settings.namespace + "isServerData"
|
private final val IsServerDataTag = Settings.namespace + "isServerData"
|
||||||
|
|
||||||
private var isChunkUnloading = false
|
|
||||||
|
|
||||||
def world = getWorld
|
def world = getWorld
|
||||||
|
|
||||||
def x = getPos.getX
|
def x = getPos.getX
|
||||||
@ -56,11 +52,12 @@ trait TileEntity extends net.minecraft.tileentity.TileEntity {
|
|||||||
|
|
||||||
override def onChunkUnload() {
|
override def onChunkUnload() {
|
||||||
super.onChunkUnload()
|
super.onChunkUnload()
|
||||||
isChunkUnloading = true
|
try dispose() catch {
|
||||||
|
case t: Throwable => OpenComputers.log.error("Failed properly disposing a tile entity, things may leak and or break.", t)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected def initialize() {
|
protected def initialize() {
|
||||||
isChunkUnloading = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def dispose() {
|
def dispose() {
|
||||||
@ -103,11 +100,6 @@ trait TileEntity extends net.minecraft.tileentity.TileEntity {
|
|||||||
if (isServer) {
|
if (isServer) {
|
||||||
writeToNBTForServer(nbt)
|
writeToNBTForServer(nbt)
|
||||||
}
|
}
|
||||||
if (isChunkUnloading) {
|
|
||||||
try dispose() catch {
|
|
||||||
case t: Throwable => OpenComputers.log.error("Failed properly disposing a tile entity, things may leak and or break.", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nbt
|
nbt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user