remove access to world field from FabricChunkGeneratorWrapper

This commit is contained in:
dfsek
2021-12-22 23:02:43 -07:00
parent fd3335508b
commit d2b52e486a
@@ -136,7 +136,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
@Override @Override
public int getWorldHeight() { public int getWorldHeight() {
return world.getTopY(); return settingsSupplier.get().getGenerationShapeConfig().height();
} }
public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) { public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
@@ -201,19 +201,19 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
@Override @Override
public int getSeaLevel() { public int getSeaLevel() {
return world.getSeaLevel(); return settingsSupplier.get().getSeaLevel();
} }
@Override @Override
public int getMinimumY() { public int getMinimumY() {
return world.getBottomY(); return settingsSupplier.get().getGenerationShapeConfig().minimumY();
} }
@Override @Override
public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView heightmapType) { public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView heightmapType) {
int height = ((ServerWorld) world).getMaxHeight(); int height = getMinimumY() + getWorldHeight();
while(height >= ((ServerWorld) world).getMinHeight() && !heightmap.getBlockPredicate().test( while(height >= getMinimumY() && !heightmap.getBlockPredicate().test(
(BlockState) ((ServerWorld) world).getGenerator().getBlock((ServerWorld) world, x, height - 1, z))) { (BlockState) delegate.getBlock((ServerWorld) world, x, height - 1, z))) {
height--; height--;
} }
return height; return height;