Region -> Tile
This commit is contained in:
parent
30faf7febf
commit
f46272b4e4
2
Engine
2
Engine
@ -1 +1 @@
|
||||
Subproject commit 4a9677caf9d6805893747ce91ffb116ec9db64e6
|
||||
Subproject commit 74305c79ee507602f7721478fbd5029bb5a9a51b
|
@ -172,6 +172,12 @@
|
||||
"display.terraforged.world.properties.sea_level": "Sea Level",
|
||||
"display.terraforged.world.properties.spawn_type": "Spawn Type",
|
||||
"display.terraforged.world.properties.world_height": "World Height",
|
||||
"display.terraforged.world.transition_points": "Transition Points",
|
||||
"display.terraforged.world.transition_points.beach": "Beach",
|
||||
"display.terraforged.world.transition_points.coast": "Coast",
|
||||
"display.terraforged.world.transition_points.deep_ocean": "Deep Ocean",
|
||||
"display.terraforged.world.transition_points.inland": "Inland",
|
||||
"display.terraforged.world.transition_points.shallow_ocean": "Shallow Ocean",
|
||||
"generator.terraforged": "TerraForged",
|
||||
"generator.terratest": "TerraTest",
|
||||
"tooltip.terraforged.climate.biome_edge_shape.gain": "Controls the gain subsequent noise octaves",
|
||||
@ -291,5 +297,10 @@
|
||||
"tooltip.terraforged.world.continent.ocean_scale": "Controls the amount of ocean between continents",
|
||||
"tooltip.terraforged.world.properties.sea_level": "Controls the sea level",
|
||||
"tooltip.terraforged.world.properties.spawn_type": "Set whether spawn should be close to x=0,z=0 or the centre of the nearest continent",
|
||||
"tooltip.terraforged.world.properties.world_height": "Controls the world height"
|
||||
"tooltip.terraforged.world.properties.world_height": "Controls the world height",
|
||||
"tooltip.terraforged.world.transition_points.beach": "The beach transition point",
|
||||
"tooltip.terraforged.world.transition_points.coast": "The coast transition point",
|
||||
"tooltip.terraforged.world.transition_points.deep_ocean": "The deep ocean transition point",
|
||||
"tooltip.terraforged.world.transition_points.inland": "The inland transition point",
|
||||
"tooltip.terraforged.world.transition_points.shallow_ocean": "The shallow ocean transition point"
|
||||
}
|
@ -34,7 +34,7 @@ import com.terraforged.feature.decorator.poisson.PoissonAtSurface;
|
||||
import com.terraforged.feature.feature.DiskFeature;
|
||||
import com.terraforged.feature.feature.FreezeLayer;
|
||||
import com.terraforged.fm.template.TemplateManager;
|
||||
import com.terraforged.settings.SettingsHelper;
|
||||
import com.terraforged.chunk.settings.SettingsHelper;
|
||||
import com.terraforged.util.DataPackFinder;
|
||||
import com.terraforged.util.Environment;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
|
@ -32,9 +32,9 @@ import com.terraforged.chunk.TerraContext;
|
||||
import com.terraforged.chunk.TerraGenSettings;
|
||||
import com.terraforged.chunk.test.TestChunkGenerator;
|
||||
import com.terraforged.gui.SettingsScreen;
|
||||
import com.terraforged.settings.DimesionSettings;
|
||||
import com.terraforged.settings.SettingsHelper;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.DimesionSettings;
|
||||
import com.terraforged.chunk.settings.SettingsHelper;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.Environment;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import com.terraforged.world.terrain.Terrains;
|
||||
|
@ -38,10 +38,10 @@ import com.terraforged.chunk.generator.SurfaceGenerator;
|
||||
import com.terraforged.chunk.generator.TerrainCarver;
|
||||
import com.terraforged.chunk.generator.TerrainGenerator;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.region.Region;
|
||||
import com.terraforged.core.region.Size;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.region.gen.RegionCache;
|
||||
import com.terraforged.core.tile.Tile;
|
||||
import com.terraforged.core.tile.Size;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.gen.TileCache;
|
||||
import com.terraforged.feature.BlockDataManager;
|
||||
import com.terraforged.fm.FeatureManager;
|
||||
import com.terraforged.fm.data.DataManager;
|
||||
@ -86,7 +86,7 @@ public class TerraChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
private final List<ColumnDecorator> baseDecorators;
|
||||
private final List<ColumnDecorator> postProcessors;
|
||||
|
||||
private final RegionCache regionCache;
|
||||
private final TileCache tileCache;
|
||||
|
||||
public TerraChunkGenerator(TerraContext context, TerraBiomeProvider biomeProvider, GenerationSettings settings) {
|
||||
super(context.world, biomeProvider, settings);
|
||||
@ -105,7 +105,7 @@ public class TerraChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
this.geologyManager = TerraSetupFactory.createGeologyManager(context);
|
||||
this.baseDecorators = TerraSetupFactory.createBaseDecorators(geologyManager, context);
|
||||
this.postProcessors = TerraSetupFactory.createFeatureDecorators(context);
|
||||
this.regionCache = context.cache;
|
||||
this.tileCache = context.cache;
|
||||
|
||||
try (DataManager data = TerraSetupFactory.createDataManager()) {
|
||||
FeatureManager.initData(data);
|
||||
@ -248,19 +248,19 @@ public class TerraChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
}
|
||||
|
||||
public final void queueChunk(int chunkX, int chunkZ) {
|
||||
int rx = regionCache.chunkToRegion(chunkX);
|
||||
int rz = regionCache.chunkToRegion(chunkZ);
|
||||
regionCache.queueRegion(rx, rz);
|
||||
int rx = tileCache.chunkToRegion(chunkX);
|
||||
int rz = tileCache.chunkToRegion(chunkZ);
|
||||
tileCache.queueRegion(rx, rz);
|
||||
}
|
||||
|
||||
public final Region getRegion(int chunkX, int chunkZ) {
|
||||
int rx = regionCache.chunkToRegion(chunkX);
|
||||
int rz = regionCache.chunkToRegion(chunkZ);
|
||||
return regionCache.getRegion(rx, rz);
|
||||
public final Tile getTile(int chunkX, int chunkZ) {
|
||||
int rx = tileCache.chunkToRegion(chunkX);
|
||||
int rz = tileCache.chunkToRegion(chunkZ);
|
||||
return tileCache.getRegion(rx, rz);
|
||||
}
|
||||
|
||||
public final ChunkReader getChunkReader(int chunkX, int chunkZ) {
|
||||
return regionCache.getChunk(chunkX, chunkZ);
|
||||
return tileCache.getChunk(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public static ChunkReader getChunk(IWorld world, ChunkGenerator<?> generator) {
|
||||
|
@ -31,10 +31,10 @@ import com.terraforged.api.chunk.surface.ChunkSurfaceBuffer;
|
||||
import com.terraforged.api.chunk.surface.SurfaceContext;
|
||||
import com.terraforged.config.PerfDefaults;
|
||||
import com.terraforged.core.concurrent.thread.ThreadPools;
|
||||
import com.terraforged.core.region.gen.RegionCache;
|
||||
import com.terraforged.core.region.gen.RegionGenerator;
|
||||
import com.terraforged.core.tile.gen.TileCache;
|
||||
import com.terraforged.core.tile.gen.TileGenerator;
|
||||
import com.terraforged.material.Materials;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.world.GeneratorContext;
|
||||
import com.terraforged.world.WorldGeneratorFactory;
|
||||
import com.terraforged.world.heightmap.Heightmap;
|
||||
@ -74,13 +74,13 @@ public class TerraContext extends GeneratorContext {
|
||||
return new SurfaceContext(buffer, levels, terrain, factory.getClimate(), settings, world.getSeed());
|
||||
}
|
||||
|
||||
public static RegionCache createCache(WorldGeneratorFactory factory) {
|
||||
public static TileCache createCache(WorldGeneratorFactory factory) {
|
||||
CommentedConfig config = PerfDefaults.getAndPrintPerfSettings();
|
||||
boolean batching = config.getOrElse("batching",false);
|
||||
int tileSize = Math.min(PerfDefaults.MAX_TILE_SIZE, Math.max(2, config.getInt("tile_size")));
|
||||
int batchCount = Math.min(PerfDefaults.MAX_BATCH_COUNT, Math.max(1, config.getInt("batch_count")));
|
||||
int threadCount = Math.min(PerfDefaults.MAX_THREAD_COUNT, Math.max(1, config.getInt("thread_count")));
|
||||
return RegionGenerator.builder()
|
||||
return TileGenerator.builder()
|
||||
.pool(ThreadPools.create(threadCount, batching))
|
||||
.size(tileSize, 2)
|
||||
.batch(batchCount)
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package com.terraforged.chunk;
|
||||
|
||||
import com.terraforged.settings.StructureSettings;
|
||||
import com.terraforged.chunk.settings.StructureSettings;
|
||||
import net.minecraft.world.gen.OverworldGenSettings;
|
||||
|
||||
public class TerraGenSettings extends OverworldGenSettings {
|
||||
|
@ -3,7 +3,7 @@ package com.terraforged.chunk.generator;
|
||||
import com.terraforged.biome.provider.TerraBiomeProvider;
|
||||
import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.chunk.util.TerraContainer;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.world.terrain.decorator.Decorator;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
@ -5,7 +5,7 @@ import com.terraforged.api.chunk.column.DecoratorContext;
|
||||
import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.chunk.fix.RegionFix;
|
||||
import com.terraforged.chunk.util.TerraContainer;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.util.Environment;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
@ -6,7 +6,7 @@ import com.terraforged.api.chunk.surface.SurfaceContext;
|
||||
import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.chunk.util.FastChunk;
|
||||
import com.terraforged.chunk.util.TerraContainer;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import net.minecraft.util.SharedSeedRandom;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
|
@ -5,7 +5,7 @@ import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.chunk.column.ChunkPopulator;
|
||||
import com.terraforged.chunk.util.FastChunk;
|
||||
import com.terraforged.chunk.util.TerraContainer;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.feature.TerrainHelper;
|
||||
import com.terraforged.world.climate.Climate;
|
||||
import com.terraforged.world.heightmap.Levels;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.terraforged.settings;
|
||||
package com.terraforged.chunk.settings;
|
||||
|
||||
import com.terraforged.TerraWorld;
|
||||
import com.terraforged.core.serialization.annotation.Comment;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.terraforged.settings;
|
||||
package com.terraforged.chunk.settings;
|
||||
|
||||
import com.terraforged.core.serialization.annotation.Comment;
|
||||
import com.terraforged.core.serialization.annotation.Serializable;
|
@ -1,4 +1,4 @@
|
||||
package com.terraforged.settings;
|
||||
package com.terraforged.chunk.settings;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.terraforged.settings;
|
||||
package com.terraforged.chunk.settings;
|
||||
|
||||
import com.terraforged.core.serialization.annotation.Comment;
|
||||
import com.terraforged.core.serialization.annotation.Range;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.terraforged.settings;
|
||||
package com.terraforged.chunk.settings;
|
||||
|
||||
import com.terraforged.core.serialization.annotation.Serializable;
|
||||
import com.terraforged.core.settings.Settings;
|
@ -28,10 +28,6 @@ package com.terraforged.chunk.test;
|
||||
import com.terraforged.biome.provider.TerraBiomeProvider;
|
||||
import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.chunk.TerraContext;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.cell.Populator;
|
||||
import com.terraforged.world.GeneratorContext;
|
||||
import com.terraforged.world.heightmap.WorldHeightmap;
|
||||
import net.minecraft.world.gen.GenerationSettings;
|
||||
|
||||
public class TestChunkGenerator extends TerraChunkGenerator {
|
||||
@ -47,25 +43,4 @@ public class TestChunkGenerator extends TerraChunkGenerator {
|
||||
public TerraBiomeProvider getBiomeProvider() {
|
||||
return biomeProvider;
|
||||
}
|
||||
|
||||
private static class TestHeightMap extends WorldHeightmap {
|
||||
|
||||
private final Populator populator;
|
||||
|
||||
public TestHeightMap(GeneratorContext context) {
|
||||
super(context);
|
||||
this.populator = getPopulator(Test.getTerrainType(context.terrain));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Cell cell, float x, float y) {
|
||||
super.apply(cell, x, y);
|
||||
populator.apply(cell, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tag(Cell cell, float x, float y) {
|
||||
populator.tag(cell, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package com.terraforged.chunk.test;
|
||||
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.world.GeneratorContext;
|
||||
import com.terraforged.world.heightmap.WorldHeightmap;
|
||||
import com.terraforged.world.heightmap.Heightmap;
|
||||
import com.terraforged.world.terrain.Terrains;
|
||||
|
||||
public class TestHeightMap extends WorldHeightmap {
|
||||
public class TestHeightMap extends Heightmap {
|
||||
|
||||
private final Terrains terrains;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.terraforged.chunk.util;
|
||||
import com.terraforged.api.biome.BiomeVariant;
|
||||
import com.terraforged.biome.provider.TerraBiomeProvider;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.core.util.PosIterator;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -44,7 +44,7 @@ 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.chunk.settings.SettingsHelper;
|
||||
import com.terraforged.world.WorldGenerator;
|
||||
import com.terraforged.world.terrain.Terrain;
|
||||
import com.terraforged.world.terrain.Terrains;
|
||||
|
@ -2,7 +2,7 @@ package com.terraforged.data;
|
||||
|
||||
import com.terraforged.core.util.NameUtil;
|
||||
import com.terraforged.gui.preview2.PreviewSettings;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
|
@ -6,7 +6,7 @@ import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.concurrent.Resource;
|
||||
import com.terraforged.core.concurrent.cache.SafeCloseable;
|
||||
import com.terraforged.core.concurrent.pool.ObjectPool;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.world.heightmap.Levels;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
@ -2,7 +2,7 @@ package com.terraforged.feature.decorator.poisson;
|
||||
|
||||
import com.terraforged.chunk.TerraChunkGenerator;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.region.chunk.ChunkReader;
|
||||
import com.terraforged.core.tile.chunk.ChunkReader;
|
||||
import com.terraforged.n2d.Module;
|
||||
import com.terraforged.n2d.Source;
|
||||
import com.terraforged.n2d.util.NoiseUtil;
|
||||
|
@ -32,8 +32,8 @@ import com.terraforged.gui.page.SimplePage;
|
||||
import com.terraforged.gui.page.SimplePreviewPage;
|
||||
import com.terraforged.gui.page.WorldPage;
|
||||
import com.terraforged.gui.preview2.PreviewPage;
|
||||
import com.terraforged.settings.SettingsHelper;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.SettingsHelper;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.IGuiEventListener;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.terraforged.gui.page;
|
||||
|
||||
import com.terraforged.gui.OverlayScreen;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.terraforged.gui.page;
|
||||
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.terraforged.gui.page;
|
||||
|
||||
import com.terraforged.gui.OverlayScreen;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -28,7 +28,7 @@ package com.terraforged.gui.page;
|
||||
import com.terraforged.TerraWorld;
|
||||
import com.terraforged.gui.OverlayScreen;
|
||||
import com.terraforged.gui.element.TerraTextInput;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
@ -30,9 +30,9 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.terraforged.core.cell.Cell;
|
||||
import com.terraforged.core.concurrent.cache.CacheEntry;
|
||||
import com.terraforged.core.concurrent.thread.ThreadPools;
|
||||
import com.terraforged.core.region.Region;
|
||||
import com.terraforged.core.region.Size;
|
||||
import com.terraforged.core.region.gen.RegionGenerator;
|
||||
import com.terraforged.core.tile.Tile;
|
||||
import com.terraforged.core.tile.Size;
|
||||
import com.terraforged.core.tile.gen.TileGenerator;
|
||||
import com.terraforged.core.settings.Settings;
|
||||
import com.terraforged.n2d.util.NoiseUtil;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
@ -68,8 +68,8 @@ public class Preview extends Button {
|
||||
private int seed;
|
||||
private long lastUpdate = 0L;
|
||||
private Settings settings = new Settings();
|
||||
private CacheEntry<Region> task = null;
|
||||
private Region region = null;
|
||||
private CacheEntry<Tile> task = null;
|
||||
private Tile tile = null;
|
||||
|
||||
private String[] labels = {"Area: ", "Terrain: ", "Biome: "};
|
||||
private String[] values = {"", "", ""};
|
||||
@ -130,8 +130,8 @@ public class Preview extends Button {
|
||||
private void preRender() {
|
||||
if (task != null && task.isDone()) {
|
||||
try {
|
||||
region = task.get();
|
||||
render(region);
|
||||
tile = task.get();
|
||||
render(tile);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
@ -140,7 +140,7 @@ public class Preview extends Button {
|
||||
}
|
||||
}
|
||||
|
||||
private void render(Region region) {
|
||||
private void render(Tile tile) {
|
||||
NativeImage image = texture.getTextureData();
|
||||
if (image == null) {
|
||||
return;
|
||||
@ -150,7 +150,7 @@ public class Preview extends Button {
|
||||
Levels levels = new Levels(settings.world);
|
||||
|
||||
int stroke = 2;
|
||||
int width = region.getBlockSize().size;
|
||||
int width = tile.getBlockSize().size;
|
||||
int zoom = (101 - previewSettings.zoom);
|
||||
int half = width / 2;
|
||||
|
||||
@ -163,7 +163,7 @@ public class Preview extends Button {
|
||||
float waterLevelModifier = settings.world.properties.seaLevel / (float) settings.world.properties.worldHeight;
|
||||
float imageWaterLevelY = image.getHeight() - 1 - (waterLevelModifier * SLICE_HEIGHT * unit);
|
||||
|
||||
region.iterate((cell, x, z) -> {
|
||||
tile.iterate((cell, x, z) -> {
|
||||
if (x < stroke || z < stroke || x >= width - stroke || z >= width - stroke) {
|
||||
image.setPixelRGBA(x, z, Color.BLACK.getRGB());
|
||||
} else {
|
||||
@ -192,7 +192,7 @@ public class Preview extends Button {
|
||||
texture.updateDynamicTexture();
|
||||
}
|
||||
|
||||
private CacheEntry<Region> generate(Settings settings, CompoundNBT prevSettings) {
|
||||
private CacheEntry<Tile> generate(Settings settings, CompoundNBT prevSettings) {
|
||||
NBTHelper.deserialize(prevSettings, previewSettings);
|
||||
settings.world.seed = seed;
|
||||
this.settings = settings;
|
||||
@ -202,7 +202,7 @@ public class Preview extends Button {
|
||||
MutableVeci center = new MutableVeci();
|
||||
context.factory.getHeightmap().getContinent().getNearestCenter(offsetX, offsetZ, center);
|
||||
|
||||
RegionGenerator renderer = RegionGenerator.builder()
|
||||
TileGenerator renderer = TileGenerator.builder()
|
||||
.pool(ThreadPools.getPool())
|
||||
.size(FACTOR, 0)
|
||||
.factory(context.factory)
|
||||
@ -215,20 +215,20 @@ public class Preview extends Button {
|
||||
}
|
||||
|
||||
private void updateLegend(int mx ,int my) {
|
||||
if (region != null) {
|
||||
if (tile != null) {
|
||||
int left = this.x;
|
||||
int top = this.y;
|
||||
float size = this.width;
|
||||
int zoom = (101 - previewSettings.zoom);
|
||||
int width = Math.max(1, region.getBlockSize().size * zoom);
|
||||
int height = Math.max(1, region.getBlockSize().size * zoom);
|
||||
int width = Math.max(1, tile.getBlockSize().size * zoom);
|
||||
int height = Math.max(1, tile.getBlockSize().size * zoom);
|
||||
values[0] = width + "x" + height;
|
||||
if (mx >= left && mx <= left + size && my >= top && my <= top + size) {
|
||||
float fx = (mx - left) / size;
|
||||
float fz = (my - top) / size;
|
||||
int ix = NoiseUtil.round(fx * region.getBlockSize().size);
|
||||
int iz = NoiseUtil.round(fz * region.getBlockSize().size);
|
||||
Cell cell = region.getCell(ix, iz);
|
||||
int ix = NoiseUtil.round(fx * tile.getBlockSize().size);
|
||||
int iz = NoiseUtil.round(fz * tile.getBlockSize().size);
|
||||
Cell cell = tile.getCell(ix, iz);
|
||||
values[1] = getTerrainName(cell);
|
||||
values[2] = getBiomeName(cell);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package com.terraforged.gui.preview;
|
||||
import com.terraforged.gui.OverlayScreen;
|
||||
import com.terraforged.gui.element.TerraButton;
|
||||
import com.terraforged.gui.page.UpdatablePage;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
|
@ -3,11 +3,11 @@ package com.terraforged.gui.preview2;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.terraforged.core.concurrent.thread.ThreadPool;
|
||||
import com.terraforged.core.concurrent.thread.ThreadPools;
|
||||
import com.terraforged.core.region.gen.RegionGenerator;
|
||||
import com.terraforged.core.tile.gen.TileGenerator;
|
||||
import com.terraforged.core.render.RenderAPI;
|
||||
import com.terraforged.core.render.RenderSettings;
|
||||
import com.terraforged.core.render.RenderWorld;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.world.GeneratorContext;
|
||||
import com.terraforged.world.continent.MutableVeci;
|
||||
import com.terraforged.world.continent.SpawnType;
|
||||
@ -100,7 +100,7 @@ public class Preview extends Widget {
|
||||
offsetX = center.x;
|
||||
offsetZ = center.z;
|
||||
|
||||
RegionGenerator generator = RegionGenerator.builder()
|
||||
TileGenerator generator = TileGenerator.builder()
|
||||
.pool(threadPool)
|
||||
.size(size, 0)
|
||||
.factory(context.factory)
|
||||
|
@ -3,7 +3,7 @@ package com.terraforged.gui.preview2;
|
||||
import com.terraforged.gui.OverlayScreen;
|
||||
import com.terraforged.gui.element.TerraButton;
|
||||
import com.terraforged.gui.page.UpdatablePage;
|
||||
import com.terraforged.settings.TerraSettings;
|
||||
import com.terraforged.chunk.settings.TerraSettings;
|
||||
import com.terraforged.util.nbt.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user