fix #3591, possibly

This commit is contained in:
Adrian Siekierka 2023-05-07 09:54:24 +02:00
parent 25773cc5eb
commit f8cb77e441
2 changed files with 15 additions and 12 deletions

View File

@ -26,7 +26,8 @@
* forceNativeLibPathFirst allows choosing a directory to check for natives in, instead of always searching in the jar for one. This allows custom natives to be used without packing them into the mod jar first, which should be much easier for end users. * forceNativeLibPathFirst allows choosing a directory to check for natives in, instead of always searching in the jar for one. This allows custom natives to be used without packing them into the mod jar first, which should be much easier for end users.
* Changed: The game now crashes instead of reloading defaults if a config file is present but invalid. * Changed: The game now crashes instead of reloading defaults if a config file is present but invalid.
* Fixed: [#3588] Renaming over other files does not properly free space. * Fixed: [#3588] Renaming over other files does not properly free space.
* Removed: Native Lua library support for x86 macOS. * Fixed: [#3591] Memory leak with wrapped worlds from other mods.
* Removed: Native Lua library support for x86 (32-bit) macOS.
* (1.7.10) Fixed: [#3239] Inconsistencies in Robot block clicking. * (1.7.10) Fixed: [#3239] Inconsistencies in Robot block clicking.
## OpenOS fixes/improvements ## OpenOS fixes/improvements

View File

@ -9,7 +9,6 @@ import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.Future import java.util.concurrent.Future
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException import java.util.concurrent.TimeoutException
import cpw.mods.fml.common.eventhandler.EventPriority import cpw.mods.fml.common.eventhandler.EventPriority
import cpw.mods.fml.common.eventhandler.SubscribeEvent import cpw.mods.fml.common.eventhandler.SubscribeEvent
import li.cil.oc.OpenComputers import li.cil.oc.OpenComputers
@ -21,8 +20,7 @@ import li.cil.oc.util.SafeThreadPool
import li.cil.oc.util.ThreadPoolFactory import li.cil.oc.util.ThreadPoolFactory
import net.minecraft.nbt.CompressedStreamTools import net.minecraft.nbt.CompressedStreamTools
import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagCompound
import net.minecraft.world.ChunkCoordIntPair import net.minecraft.world.{ChunkCoordIntPair, World, WorldServer}
import net.minecraft.world.World
import net.minecraftforge.common.DimensionManager import net.minecraftforge.common.DimensionManager
import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.event.world.WorldEvent
import org.apache.commons.lang3.JavaVersion import org.apache.commons.lang3.JavaVersion
@ -101,6 +99,9 @@ object SaveHandler {
def scheduleSave(position: BlockPosition, nbt: NBTTagCompound, name: String, data: Array[Byte]) { def scheduleSave(position: BlockPosition, nbt: NBTTagCompound, name: String, data: Array[Byte]) {
val world = position.world.get val world = position.world.get
// Try to exclude wrapped/client-side worlds.
if (world.isInstanceOf[WorldServer]) {
val dimension = world.provider.dimensionId val dimension = world.provider.dimensionId
val chunk = new ChunkCoordIntPair(position.x >> 4, position.z >> 4) val chunk = new ChunkCoordIntPair(position.x >> 4, position.z >> 4)
@ -112,6 +113,7 @@ object SaveHandler {
scheduleSave(dimension, chunk, name, data) scheduleSave(dimension, chunk, name, data)
} }
}
private def writeNBT(save: NBTTagCompound => Unit) = { private def writeNBT(save: NBTTagCompound => Unit) = {
val tmpNbt = new NBTTagCompound() val tmpNbt = new NBTTagCompound()