From c30b3c09efe6b8a1c18737f069bb3aa6b84c007f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 29 Jan 2017 01:02:15 +0100 Subject: [PATCH] Oh great, so now onChunkUnload is called before writeToNBT again .-. Could guys *please* decide on one? --- .../oc/common/tileentity/traits/TileEntity.scala | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/scala/li/cil/oc/common/tileentity/traits/TileEntity.scala b/src/main/scala/li/cil/oc/common/tileentity/traits/TileEntity.scala index bbc397f7c..06753f294 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/traits/TileEntity.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/traits/TileEntity.scala @@ -1,7 +1,5 @@ package li.cil.oc.common.tileentity.traits -import java.util.Date - import li.cil.oc.OpenComputers import li.cil.oc.Settings import li.cil.oc.client.Sound @@ -20,8 +18,6 @@ import net.minecraftforge.fml.relauncher.SideOnly trait TileEntity extends net.minecraft.tileentity.TileEntity { private final val IsServerDataTag = Settings.namespace + "isServerData" - private var isChunkUnloading = false - def world = getWorld def x = getPos.getX @@ -56,11 +52,12 @@ trait TileEntity extends net.minecraft.tileentity.TileEntity { override def 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() { - isChunkUnloading = false } def dispose() { @@ -103,11 +100,6 @@ trait TileEntity extends net.minecraft.tileentity.TileEntity { if (isServer) { 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 }