Fixed all remaining compile errors (mind the TODOs, a lot of things are disabled)

This commit is contained in:
Frank 2021-12-07 17:42:18 +01:00
parent 108d2bd710
commit 6c89c76c26
34 changed files with 241 additions and 430 deletions

View file

@ -1,5 +1,7 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
public class DesertLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
@ -123,10 +123,8 @@ public class DesertLakeFeature extends DefaultFeature {
}
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
state = world.getBiome(pos)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -198,10 +196,8 @@ public class DesertLakeFeature extends DefaultFeature {
}
else if (y < waterLevel) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -1,5 +1,7 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -17,8 +19,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
@ -123,10 +123,12 @@ public class EndLakeFeature extends DefaultFeature {
}
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
state = world.getBiome(pos)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(pos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -193,10 +195,12 @@ public class EndLakeFeature extends DefaultFeature {
// Make border
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS)
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(POS)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -1,6 +1,11 @@
package ru.betterend.world.features.terrain;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.WorldGenLevel;
@ -17,9 +22,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import java.util.List;
import java.util.Random;
public class FloatingSpireFeature extends SpireFeature {
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
@ -62,13 +64,16 @@ public class FloatingSpireFeature extends SpireFeature {
if (random.nextInt(16) == 0) {
support.add(info.getPos().above());
}
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
return world.getBiome(info.getPos())
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getUnderMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getUnderMaterial();
}
return info.getState();
});
@ -77,7 +82,7 @@ public class FloatingSpireFeature extends SpireFeature {
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
}
});

View file

@ -1,5 +1,9 @@
package ru.betterend.world.features.terrain;
import java.util.Optional;
import java.util.Random;
import java.util.function.Function;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
@ -37,9 +41,6 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.util.BlockFixer;
import java.util.Random;
import java.util.function.Function;
public class GeyserFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE1;
protected static final Function<BlockState, Boolean> REPLACE2;
@ -259,7 +260,7 @@ public class GeyserFeature extends DefaultFeature {
}
EndFeatures.SULPHURIC_LAKE.getFeature()
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, pos, null));
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, pos, null));
double distance = radius1 * 1.7;
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);

View file

@ -1,6 +1,12 @@
package ru.betterend.world.features.terrain;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.function.Function;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.WorldGenLevel;
@ -11,8 +17,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFSmoothUnion;
@ -24,10 +30,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
public class SpireFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE;
@ -65,13 +67,17 @@ public class SpireFeature extends DefaultFeature {
if (random.nextInt(16) == 0) {
support.add(info.getPos().above());
}
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
//return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
return world.getBiome(info.getPos())
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getUnderMaterial();
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getUnderMaterial();
}
return info.getState();
}).fillRecursive(world, center);
@ -79,7 +85,7 @@ public class SpireFeature extends DefaultFeature {
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
.place(new FeaturePlaceContext<>(Optional.empty(), world, chunkGenerator, random, bpos, null));
}
});

View file

@ -1,6 +1,10 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -22,9 +26,6 @@ import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import java.util.Random;
import java.util.Set;
public class SulphuricCaveFeature extends DefaultFeature {
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
@ -167,7 +168,8 @@ public class SulphuricCaveFeature extends DefaultFeature {
state = world.getBlockState(mut);
while (state.is(Blocks.WATER)) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.VENT_BUBBLE_COLUMN.defaultBlockState());
world.getBlockTicks()
//TODO: 1.18 test ticks
world/*.getBlockTicks()*/
.scheduleTick(mut, EndBlocks.VENT_BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
mut.setY(mut.getY() + 1);
state = world.getBlockState(mut);

View file

@ -1,6 +1,10 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -19,9 +23,6 @@ import ru.betterend.blocks.SulphurCrystalBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import java.util.Random;
import java.util.Set;
public class SulphuricLakeFeature extends DefaultFeature {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
private static final MutableBlockPos POS = new MutableBlockPos();
@ -75,7 +76,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
else {
if (!isAbsoluteBorder(world, POS)) {
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
world.getLiquidTicks().scheduleTick(POS, Fluids.WATER, 0);
//TODO: 1.18 check if this ticks
world./*getLiquidTicks().*/scheduleTick(POS, Fluids.WATER, 0);
brimstone.add(POS.below());
if (random.nextBoolean()) {
brimstone.add(POS.below(2));

View file

@ -1,6 +1,12 @@
package ru.betterend.world.features.terrain.caves;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import java.util.function.Supplier;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
@ -16,10 +22,6 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.cave.EndCaveBiome;
import java.util.Random;
import java.util.Set;
import java.util.function.Supplier;
public class CaveChunkPopulatorFeature extends DefaultFeature {
private Supplier<EndCaveBiome> supplier;
@ -40,7 +42,8 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
MutableBlockPos max = new MutableBlockPos().set(pos);
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
EndCaveBiome biome = supplier.get();
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
//TODO: 1.18 This needs to change to a configured material
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
placeCeil(world, biome, ceilPositions, random);
BlockFixer.fixBlocks(world, min, max);
@ -111,7 +114,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
}
}
});
@ -127,7 +130,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
}
}
});

View file

@ -1,7 +1,13 @@
package ru.betterend.world.features.terrain.caves;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -14,9 +20,8 @@ import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.interfaces.BiomeSetter;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.bclib.world.biomes.BCLBiome;
@ -25,10 +30,6 @@ import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.cave.EndCaveBiome;
import java.util.List;
import java.util.Random;
import java.util.Set;
public abstract class EndCaveFeature extends DefaultFeature {
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
protected static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
@ -74,10 +75,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
}
}
});
BlockState surfaceBlock = biome.getBiome()
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
placeCeil(world, biome, ceilPositions, random);
placeWalls(world, biome, caveBlocks, random);
@ -99,7 +99,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
}
}
});
@ -115,7 +115,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
}
}
});
@ -153,12 +153,13 @@ public abstract class EndCaveFeature extends DefaultFeature {
protected void setBiomes(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> blocks) {
blocks.forEach((pos) -> setBiome(world, pos, biome));
}
protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
if (array != null) {
array.bclib_setBiome(biome.getActualBiome(), pos);
}
//TODO: 1.18 No longer implemented in BCLib
// BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
// if (array != null) {
// array.bclib_setBiome(biome.getActualBiome(), pos);
// }
}
private BlockPos findPos(WorldGenLevel world, BlockPos pos, int radius, Random random) {

View file

@ -1,7 +1,14 @@
package ru.betterend.world.features.terrain.caves;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import java.util.stream.IntStream;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -15,19 +22,14 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.world.biomes.BCLBiome;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.world.biome.cave.EndCaveBiome;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.stream.IntStream;
public class TunelCaveFeature extends EndCaveFeature {
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
int cx = center.getX() >> 4;
@ -166,10 +168,12 @@ public class TunelCaveFeature extends EndCaveFeature {
}
floorSets.forEach((biome, floorPositions) -> {
BlockState surfaceBlock = biome.getBiome()
.getGenerationSettings()
.getSurfaceBuilderConfig()
.getTopMaterial();
//TODO: 1.18 this needs to change to a dynamic block
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState();
// BlockState surfaceBlock = biome.getBiome()
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
});
ceilSets.forEach((biome, ceilPositions) -> {
@ -197,7 +201,7 @@ public class TunelCaveFeature extends EndCaveFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
}
}
});
@ -214,7 +218,7 @@ public class TunelCaveFeature extends EndCaveFeature {
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
if (feature != null) {
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
}
}
});