Replaced spaces, proper biome getter, imports cleanup
This commit is contained in:
parent
91e7bab993
commit
58310d020c
26 changed files with 979 additions and 981 deletions
|
@ -20,54 +20,54 @@ import ru.betterend.world.structures.piece.NBTPiece;
|
|||
import java.util.Random;
|
||||
|
||||
public class EternalPortalStructure extends FeatureBaseStructure {
|
||||
private static final ResourceLocation STRUCTURE_ID = BetterEnd.makeID("portal/eternal_portal");
|
||||
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
|
||||
private static final ResourceLocation STRUCTURE_ID = BetterEnd.makeID("portal/eternal_portal");
|
||||
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
|
||||
|
||||
public EternalPortalStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
EternalPortalStructure::checkLocation,
|
||||
EternalPortalStructure::generatePieces
|
||||
));
|
||||
}
|
||||
public EternalPortalStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
EternalPortalStructure::checkLocation,
|
||||
EternalPortalStructure::generatePieces
|
||||
));
|
||||
}
|
||||
|
||||
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
||||
if (!BCLStructureFeature.isValidBiome(context)) return false;
|
||||
protected static boolean checkLocation(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> context) {
|
||||
if (!BCLStructureFeature.isValidBiome(context)) return false;
|
||||
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
|
||||
long x = (long) chunkPos.x * (long) chunkPos.x;
|
||||
long z = (long) chunkPos.z * (long) chunkPos.z;
|
||||
if (x + z < 1024L) {
|
||||
return false;
|
||||
}
|
||||
if (chunkGenerator.getBaseHeight(
|
||||
chunkPos.getBlockX(8),
|
||||
chunkPos.getBlockZ(8),
|
||||
Heightmap.Types.WORLD_SURFACE_WG,
|
||||
levelHeightAccessor
|
||||
) < 5) {
|
||||
return false;
|
||||
}
|
||||
return FeatureBaseStructure.checkLocation(context);
|
||||
}
|
||||
long x = (long) chunkPos.x * (long) chunkPos.x;
|
||||
long z = (long) chunkPos.z * (long) chunkPos.z;
|
||||
if (x + z < 1024L) {
|
||||
return false;
|
||||
}
|
||||
if (chunkGenerator.getBaseHeight(
|
||||
chunkPos.getBlockX(8),
|
||||
chunkPos.getBlockZ(8),
|
||||
Heightmap.Types.WORLD_SURFACE_WG,
|
||||
levelHeightAccessor
|
||||
) < 5) {
|
||||
return false;
|
||||
}
|
||||
return FeatureBaseStructure.checkLocation(context);
|
||||
}
|
||||
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
int x = chunkPos.getBlockX(8);
|
||||
int z = chunkPos.getBlockZ(8);
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
structurePiecesBuilder.addPiece(new NBTPiece(
|
||||
STRUCTURE_ID,
|
||||
STRUCTURE,
|
||||
new BlockPos(x, y - 4, z),
|
||||
random.nextInt(5),
|
||||
true,
|
||||
random
|
||||
));
|
||||
}
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
int x = chunkPos.getBlockX(8);
|
||||
int z = chunkPos.getBlockZ(8);
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
structurePiecesBuilder.addPiece(new NBTPiece(
|
||||
STRUCTURE_ID,
|
||||
STRUCTURE,
|
||||
new BlockPos(x, y - 4, z),
|
||||
random.nextInt(5),
|
||||
true,
|
||||
random
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,33 +16,32 @@ import ru.betterend.world.structures.piece.LakePiece;
|
|||
import java.util.Random;
|
||||
|
||||
public class MegaLakeSmallStructure extends FeatureBaseStructure {
|
||||
public MegaLakeSmallStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MegaLakeSmallStructure::generatePieces
|
||||
));
|
||||
}
|
||||
public MegaLakeSmallStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MegaLakeSmallStructure::generatePieces
|
||||
));
|
||||
}
|
||||
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
|
||||
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x >> 2, y >> 2, z >> 2);
|
||||
if (y > 5) {
|
||||
float radius = MHelper.randRange(20, 40, random);
|
||||
float depth = MHelper.randRange(5, 10, random);
|
||||
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
|
||||
//TODO: 1.18 right way to get biome?
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
|
||||
if (y > 5) {
|
||||
float radius = MHelper.randRange(20, 40, random);
|
||||
float depth = MHelper.randRange(5, 10, random);
|
||||
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,34 +18,33 @@ import java.util.Random;
|
|||
public class MegaLakeStructure extends FeatureBaseStructure {
|
||||
|
||||
|
||||
public MegaLakeStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MegaLakeStructure::generatePieces
|
||||
));
|
||||
}
|
||||
public MegaLakeStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MegaLakeStructure::generatePieces
|
||||
));
|
||||
}
|
||||
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
|
||||
if (y > 5) {
|
||||
//TODO: 1.18 right way to get biome?
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
|
||||
if (y > 5) {
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x >> 2, y >> 2, z >> 2);
|
||||
|
||||
float radius = MHelper.randRange(32, 64, random);
|
||||
float depth = MHelper.randRange(7, 15, random);
|
||||
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
float radius = MHelper.randRange(32, 64, random);
|
||||
float depth = MHelper.randRange(7, 15, random);
|
||||
LakePiece piece = new LakePiece(new BlockPos(x, y, z), radius, depth, random, biome);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,39 +17,39 @@ import java.util.Random;
|
|||
|
||||
public class MountainStructure extends FeatureBaseStructure {
|
||||
|
||||
public MountainStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MountainStructure::generatePieces
|
||||
));
|
||||
}
|
||||
public MountainStructure() {
|
||||
super(PieceGeneratorSupplier.simple(
|
||||
FeatureBaseStructure::checkLocation,
|
||||
MountainStructure::generatePieces
|
||||
));
|
||||
}
|
||||
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
protected static void generatePieces(StructurePiecesBuilder structurePiecesBuilder, PieceGenerator.Context<NoneFeatureConfiguration> context) {
|
||||
final Random random = context.random();
|
||||
final ChunkPos chunkPos = context.chunkPos();
|
||||
final ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
final LevelHeightAccessor levelHeightAccessor = context.heightAccessor();
|
||||
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
if (y > 5) {
|
||||
//TODO: 1.18 right way to get biome?
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
|
||||
int x = chunkPos.getBlockX(MHelper.randRange(4, 12, random));
|
||||
int z = chunkPos.getBlockZ(MHelper.randRange(4, 12, random));
|
||||
int y = chunkGenerator.getBaseHeight(x, z, Types.WORLD_SURFACE_WG, levelHeightAccessor);
|
||||
if (y > 5) {
|
||||
//TODO: 1.18 right way to get biome?
|
||||
Biome biome = chunkGenerator.getNoiseBiome(x, y, z);
|
||||
|
||||
float radius = MHelper.randRange(50, 100, random);
|
||||
float height = radius * MHelper.randRange(0.8F, 1.2F, random);
|
||||
CrystalMountainPiece piece = new CrystalMountainPiece(
|
||||
new BlockPos(x, y, z),
|
||||
radius,
|
||||
height,
|
||||
random,
|
||||
biome
|
||||
);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
float radius = MHelper.randRange(50, 100, random);
|
||||
float height = radius * MHelper.randRange(0.8F, 1.2F, random);
|
||||
CrystalMountainPiece piece = new CrystalMountainPiece(
|
||||
new BlockPos(x, y, z),
|
||||
radius,
|
||||
height,
|
||||
random,
|
||||
biome
|
||||
);
|
||||
structurePiecesBuilder.addPiece(piece);
|
||||
}
|
||||
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
//this.calculateBoundingBox();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class CavePiece extends BasePiece {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int x1 = MHelper.max(this.boundingBox.minX(), blockBox.minX());
|
||||
int z1 = MHelper.max(this.boundingBox.minZ(), blockBox.minZ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue