unbreak the things

This commit is contained in:
dags- 2020-06-02 14:33:31 +01:00
parent 904580ef38
commit 011a0bf4ba
4 changed files with 14 additions and 10 deletions

2
Engine

@ -1 +1 @@
Subproject commit 7f617d303c09d52d4242379ef87bc4b679d8fcea
Subproject commit 5c77c566a5e5fd035d3421c1a3b58d7d3fc7bb9d

View File

@ -33,6 +33,7 @@ import com.terraforged.chunk.TerraContext;
import com.terraforged.chunk.util.FastChunk;
import com.terraforged.chunk.util.TerraContainer;
import com.terraforged.core.cell.Cell;
import com.terraforged.core.concurrent.Resource;
import com.terraforged.core.region.chunk.ChunkReader;
import com.terraforged.util.setup.SetupHooks;
import com.terraforged.world.heightmap.WorldLookup;
@ -66,7 +67,7 @@ public class BiomeProvider extends AbstractBiomeProvider {
this.modifierManager = SetupHooks.setup(new BiomeModifierManager(context, biomeMap), context.copy());
}
public Cell lookupPos(int x, int z) {
public Resource<Cell> lookupPos(int x, int z) {
return getWorldLookup().getCell(x, z);
}
@ -74,7 +75,9 @@ public class BiomeProvider extends AbstractBiomeProvider {
public Biome getNoiseBiome(int x, int y, int z) {
x = (x << 2);
z = (z << 2);
return getBiome(lookupPos(x, z), x, z);
try (Resource<Cell> cell = lookupPos(x, z)) {
return getBiome(cell.get(), x, z);
}
}
@Override

View File

@ -75,7 +75,6 @@ public class TerrainGenerator {
// bake biome array & discard gen data
((ChunkPrimer) chunk).func_225548_a_(container.bakeBiomes(Environment.isVanillaBiomes()));
// marks the heightmap data for this chunk for removal
container.getChunkReader().dispose();
}

View File

@ -42,6 +42,7 @@ import com.terraforged.command.search.BothSearchTask;
import com.terraforged.command.search.Search;
import com.terraforged.command.search.TerrainSearchTask;
import com.terraforged.core.cell.Cell;
import com.terraforged.core.concurrent.Resource;
import com.terraforged.data.DataGen;
import com.terraforged.settings.SettingsHelper;
import com.terraforged.world.WorldGenerator;
@ -126,12 +127,13 @@ public class TerraCommand {
BlockPos pos = context.getSource().asPlayer().getPosition();
BiomeProvider biomeProvider = getBiomeProvider(context);
Cell cell = biomeProvider.lookupPos(pos.getX(), pos.getZ());
Biome biome = biomeProvider.getBiome(cell, pos.getX(), pos.getZ());
context.getSource().sendFeedback(
new StringTextComponent("Terrain=" + cell.terrain.getName() + ", Biome=" + biome.getRegistryName()),
false
);
try (Resource<Cell> cell = biomeProvider.lookupPos(pos.getX(), pos.getZ())) {
Biome biome = biomeProvider.getBiome(cell.get(), pos.getX(), pos.getZ());
context.getSource().sendFeedback(
new StringTextComponent("Terrain=" + cell.get().terrain.getName() + ", Biome=" + biome.getRegistryName()),
false
);
}
return Command.SINGLE_SUCCESS;
}