Added BiomeTest to feature placers
This commit is contained in:
parent
df6845642f
commit
2c5c030f29
2 changed files with 5 additions and 1 deletions
|
@ -15,6 +15,7 @@ import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplie
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
import ru.bclib.util.StructureHelper;
|
import ru.bclib.util.StructureHelper;
|
||||||
|
import ru.bclib.world.structures.BCLStructureFeature;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.world.structures.piece.NBTPiece;
|
import ru.betterend.world.structures.piece.NBTPiece;
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ public class EternalPortalStructure extends FeatureBaseStructure {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
||||||
|
if (!BCLStructureFeature.isValidBiome(context)) return false;
|
||||||
|
|
||||||
final ChunkPos chunkPos = context.chunkPos();
|
final ChunkPos chunkPos = context.chunkPos();
|
||||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier;
|
import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier;
|
||||||
|
import ru.bclib.world.structures.BCLStructureFeature;
|
||||||
|
|
||||||
public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureConfiguration> {
|
public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureConfiguration> {
|
||||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||||
|
@ -21,7 +22,7 @@ public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
||||||
return getGenerationHeight(context.chunkPos(), context.chunkGenerator(), context.heightAccessor()) >= 20;
|
return getGenerationHeight(context.chunkPos(), context.chunkGenerator(), context.heightAccessor()) >= 20 && BCLStructureFeature.isValidBiome(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getGenerationHeight(ChunkPos chunkPos, ChunkGenerator chunkGenerator, LevelHeightAccessor levelHeightAccessor) {
|
private static int getGenerationHeight(ChunkPos chunkPos, ChunkGenerator chunkGenerator, LevelHeightAccessor levelHeightAccessor) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue