mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
fix mem leak & increase perf
This commit is contained in:
parent
ebe887def0
commit
2215c8a98c
@ -36,10 +36,13 @@ import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
private final Map<Long, TerraWorld> worldMap = new HashMap<>();
|
||||
private static TerraFabricPlugin instance;
|
||||
private final TerraChunkGeneratorCodec chunkGeneratorCodec = new TerraChunkGeneratorCodec(this);
|
||||
|
||||
@ -72,7 +75,10 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
|
||||
@Override
|
||||
public TerraWorld getWorld(World world) {
|
||||
return new TerraWorld(world, getRegistry().get("DEFAULT"), this);
|
||||
return worldMap.computeIfAbsent(world.getSeed(), w -> {
|
||||
logger.info("Loading world " + w);
|
||||
return new TerraWorld(world, getRegistry().get("DEFAULT"), this);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +40,7 @@ public class FabricWorldChunkRegion implements World {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getWorldFolder().getName();
|
||||
return delegate.chunk.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user