mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Height fixes
This commit is contained in:
parent
32dac5fbe2
commit
8c00499e76
@ -145,7 +145,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
|
||||
@BlockCoordinates
|
||||
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException {
|
||||
generate(x, z, Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc), multicore);
|
||||
generate(x, z, Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight()), multicore);
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
|
@ -139,7 +139,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
IrisBiomeStorage st = new IrisBiomeStorage();
|
||||
TerrainChunk tc = TerrainChunk.createUnsafe(world, st);
|
||||
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight());
|
||||
this.world.bind(world);
|
||||
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
||||
Iris.debug("Regenerated " + x + " " + z);
|
||||
@ -284,7 +284,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
studioGenerator.generateChunk(getEngine(), tc, x, z);
|
||||
} else {
|
||||
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight());
|
||||
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class HeadlessGenerator implements PlatformChunkGenerator {
|
||||
INMS.get().getTrueBiomeBaseId(biomeBase)))
|
||||
.build();
|
||||
getEngine().generate(x << 4, z << 4,
|
||||
Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc),
|
||||
Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight()),
|
||||
false);
|
||||
chunk.cleanupPalettesAndBlockStates();
|
||||
} catch (Throwable e) {
|
||||
|
@ -98,8 +98,8 @@ public interface Hunk<T> {
|
||||
return new FunctionalHunkView<A, B>(src, reader, writer);
|
||||
}
|
||||
|
||||
static Hunk<Biome> view(BiomeGrid biome) {
|
||||
return new BiomeGridHunkView(biome);
|
||||
static Hunk<Biome> view(BiomeGrid biome, int minHeight, int maxHeight) {
|
||||
return new BiomeGridHunkView(biome, minHeight, maxHeight);
|
||||
}
|
||||
|
||||
static <T> Hunk<T> fringe(Hunk<T> i, Hunk<T> o) {
|
||||
|
@ -29,9 +29,13 @@ import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
public class BiomeGridHunkView implements Hunk<Biome> {
|
||||
@Getter
|
||||
private final BiomeGrid chunk;
|
||||
private final int minHeight;
|
||||
private final int maxHeight;
|
||||
|
||||
public BiomeGridHunkView(BiomeGrid chunk) {
|
||||
public BiomeGridHunkView(BiomeGrid chunk, int minHeight, int maxHeight) {
|
||||
this.chunk = chunk;
|
||||
this.minHeight = minHeight;
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,25 +50,24 @@ public class BiomeGridHunkView implements Hunk<Biome> {
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
// TODO: WARNING HEIGHT
|
||||
return 256;
|
||||
return maxHeight - minHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, Biome t) {
|
||||
chunk.setBiome(x, y, z, t);
|
||||
chunk.setBiome(x, y+minHeight, z, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getRaw(int x, int y, int z) {
|
||||
return chunk.getBiome(x, y, z);
|
||||
return chunk.getBiome(x, y+minHeight, z);
|
||||
}
|
||||
|
||||
public void forceBiomeBaseInto(int x, int y, int z, Object somethingVeryDirty) {
|
||||
if (chunk instanceof LinkedTerrainChunk) {
|
||||
INMS.get().forceBiomeInto(x, y, z, somethingVeryDirty, ((LinkedTerrainChunk) chunk).getRawBiome());
|
||||
INMS.get().forceBiomeInto(x, y+minHeight, z, somethingVeryDirty, ((LinkedTerrainChunk) chunk).getRawBiome());
|
||||
return;
|
||||
}
|
||||
INMS.get().forceBiomeInto(x, y, z, somethingVeryDirty, chunk);
|
||||
INMS.get().forceBiomeInto(x, y+minHeight, z, somethingVeryDirty, chunk);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class ChunkDataHunkView implements Hunk<BlockData> {
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return chunk.getMaxHeight();
|
||||
return chunk.getMaxHeight() - chunk.getMinHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,7 +51,7 @@ public class ChunkDataHunkView implements Hunk<BlockData> {
|
||||
return;
|
||||
}
|
||||
|
||||
chunk.setRegion(x1, y1, z1, x2, y2, z2, t);
|
||||
chunk.setRegion(x1, y1+chunk.getMinHeight(), z1, x2, y2+chunk.getMinHeight(), z2, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,11 +60,11 @@ public class ChunkDataHunkView implements Hunk<BlockData> {
|
||||
return;
|
||||
}
|
||||
|
||||
chunk.setBlock(x, y, z, t);
|
||||
chunk.setBlock(x, y+chunk.getMinHeight(), z, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getRaw(int x, int y, int z) {
|
||||
return chunk.getBlockData(x, y, z);
|
||||
return chunk.getBlockData(x, y+chunk.getMinHeight(), z);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user