Fixes & improvements
This commit is contained in:
parent
b375d76956
commit
10fae49f6a
10 changed files with 51 additions and 15 deletions
|
@ -48,16 +48,15 @@ public class BlockBrimstone extends BlockBase {
|
||||||
BlockPos side = pos.offset(dir);
|
BlockPos side = pos.offset(dir);
|
||||||
BlockState sideState = world.getBlockState(side);
|
BlockState sideState = world.getBlockState(side);
|
||||||
if (sideState.getBlock() instanceof BlockSulphurCrystal) {
|
if (sideState.getBlock() instanceof BlockSulphurCrystal) {
|
||||||
if (sideState.get(BlockSulphurCrystal.AGE) < 2) {
|
if (sideState.get(BlockSulphurCrystal.AGE) < 2 && sideState.get(BlockSulphurCrystal.WATERLOGGED)) {
|
||||||
int age = sideState.get(BlockSulphurCrystal.AGE) + 1;
|
int age = sideState.get(BlockSulphurCrystal.AGE) + 1;
|
||||||
world.setBlockState(side, sideState.with(BlockSulphurCrystal.AGE, age));
|
world.setBlockState(side, sideState.with(BlockSulphurCrystal.AGE, age));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sideState.isAir() || !sideState.getFluidState().isEmpty()) {
|
else if (sideState.getFluidState().getFluid() == Fluids.WATER) {
|
||||||
boolean water = sideState.getFluidState().getFluid().equals(Fluids.WATER);
|
|
||||||
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||||
.with(BlockSulphurCrystal.FACING, dir)
|
.with(BlockSulphurCrystal.FACING, dir)
|
||||||
.with(BlockSulphurCrystal.WATERLOGGED, water)
|
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||||
.with(BlockSulphurCrystal.AGE, 0);
|
.with(BlockSulphurCrystal.AGE, 0);
|
||||||
world.setBlockState(side, crystal);
|
world.setBlockState(side, crystal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,13 +96,15 @@ public class EndBiomes {
|
||||||
float fog = 1F;
|
float fog = 1F;
|
||||||
float chance = 1F;
|
float chance = 1F;
|
||||||
boolean isVoid = false;
|
boolean isVoid = false;
|
||||||
|
boolean hasCaves = true;
|
||||||
JsonElement element = config.get(id.getPath());
|
JsonElement element = config.get(id.getPath());
|
||||||
if (element != null && element.isJsonObject()) {
|
if (element != null && element.isJsonObject()) {
|
||||||
fog = JsonFactory.getFloat(element.getAsJsonObject(), "fogDensity", 1);
|
fog = JsonFactory.getFloat(element.getAsJsonObject(), "fogDensity", 1);
|
||||||
chance = JsonFactory.getFloat(element.getAsJsonObject(), "genChance", 1);
|
chance = JsonFactory.getFloat(element.getAsJsonObject(), "genChance", 1);
|
||||||
isVoid = JsonFactory.getString(element.getAsJsonObject(), "type", "land").equals("void");
|
isVoid = JsonFactory.getString(element.getAsJsonObject(), "type", "land").equals("void");
|
||||||
|
hasCaves = JsonFactory.getBoolean(element.getAsJsonObject(), "hasCaves", true);
|
||||||
}
|
}
|
||||||
EndBiome endBiome = new EndBiome(id, biome, fog, chance);
|
EndBiome endBiome = new EndBiome(id, biome, fog, chance, hasCaves);
|
||||||
if (isVoid) {
|
if (isVoid) {
|
||||||
VOID_BIOMES.addBiomeMutable(endBiome);
|
VOID_BIOMES.addBiomeMutable(endBiome);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +177,7 @@ public class EndBiomes {
|
||||||
* @return registered {@link EndBiome}
|
* @return registered {@link EndBiome}
|
||||||
*/
|
*/
|
||||||
public static EndBiome registerBiome(Biome biome, BiomeType type, float fogDensity, float genChance) {
|
public static EndBiome registerBiome(Biome biome, BiomeType type, float fogDensity, float genChance) {
|
||||||
EndBiome endBiome = new EndBiome(BuiltinRegistries.BIOME.getId(biome), biome, fogDensity, genChance);
|
EndBiome endBiome = new EndBiome(BuiltinRegistries.BIOME.getId(biome), biome, fogDensity, genChance, true);
|
||||||
addToPicker(endBiome, type);
|
addToPicker(endBiome, type);
|
||||||
return endBiome;
|
return endBiome;
|
||||||
}
|
}
|
||||||
|
@ -187,8 +189,8 @@ public class EndBiomes {
|
||||||
* @param genChance - generation chance [0.0F - Infinity]
|
* @param genChance - generation chance [0.0F - Infinity]
|
||||||
* @return registered {@link EndBiome}
|
* @return registered {@link EndBiome}
|
||||||
*/
|
*/
|
||||||
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float genChance) {
|
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float genChance, boolean hasCaves) {
|
||||||
return registerSubBiome(biome, parent, 1, genChance);
|
return registerSubBiome(biome, parent, 1, genChance, hasCaves);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,8 +201,8 @@ public class EndBiomes {
|
||||||
* @param genChance - generation chance [0.0F - Infinity]
|
* @param genChance - generation chance [0.0F - Infinity]
|
||||||
* @return registered {@link EndBiome}
|
* @return registered {@link EndBiome}
|
||||||
*/
|
*/
|
||||||
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float fogDensity, float genChance) {
|
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float fogDensity, float genChance, boolean hasCaves) {
|
||||||
EndBiome endBiome = new EndBiome(BuiltinRegistries.BIOME.getId(biome), biome, fogDensity, genChance);
|
EndBiome endBiome = new EndBiome(BuiltinRegistries.BIOME.getId(biome), biome, fogDensity, genChance, hasCaves);
|
||||||
parent.addSubBiome(endBiome);
|
parent.addSubBiome(endBiome);
|
||||||
SUBBIOMES.add(endBiome);
|
SUBBIOMES.add(endBiome);
|
||||||
ID_MAP.put(endBiome.getID(), endBiome);
|
ID_MAP.put(endBiome.getID(), endBiome);
|
||||||
|
@ -239,7 +241,7 @@ public class EndBiomes {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static EndBiome registerSubBiome(RegistryKey<Biome> key, EndBiome parent, float genChance) {
|
private static EndBiome registerSubBiome(RegistryKey<Biome> key, EndBiome parent, float genChance) {
|
||||||
return registerSubBiome(BuiltinRegistries.BIOME.get(key), parent, genChance);
|
return registerSubBiome(BuiltinRegistries.BIOME.get(key), parent, genChance, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addToPicker(EndBiome biome, BiomeType type) {
|
private static void addToPicker(EndBiome biome, BiomeType type) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class EndFeatures {
|
||||||
addFeature(ENDER_ORE, features);
|
addFeature(ENDER_ORE, features);
|
||||||
addFeature(CRASHED_SHIP, features);
|
addFeature(CRASHED_SHIP, features);
|
||||||
|
|
||||||
if (!id.getPath().equals("blossoming_spires")) {
|
if (EndBiomes.getBiome(id).hasCaves()) {
|
||||||
addFeature(ROUND_CAVE_RARE, features);
|
addFeature(ROUND_CAVE_RARE, features);
|
||||||
addFeature(CAVE_GRASS, features);
|
addFeature(CAVE_GRASS, features);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class BiomeBlossomingSpires extends EndBiome {
|
||||||
.setFogColor(241, 146, 229)
|
.setFogColor(241, 146, 229)
|
||||||
.setFogDensity(1.7F)
|
.setFogDensity(1.7F)
|
||||||
.setPlantsColor(122, 45, 122)
|
.setPlantsColor(122, 45, 122)
|
||||||
|
.setCaves(false)
|
||||||
.setSurface(EndBlocks.PINK_MOSS)
|
.setSurface(EndBlocks.PINK_MOSS)
|
||||||
.setMusic(EndSounds.MUSIC_BLOSSOMING_SPIRES)
|
.setMusic(EndSounds.MUSIC_BLOSSOMING_SPIRES)
|
||||||
.setLoop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
|
.setLoop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class BiomeDefinition {
|
||||||
|
|
||||||
private final Identifier id;
|
private final Identifier id;
|
||||||
private float genChance = 1F;
|
private float genChance = 1F;
|
||||||
|
private boolean hasCaves = true;
|
||||||
|
|
||||||
private ConfiguredSurfaceBuilder<?> surface;
|
private ConfiguredSurfaceBuilder<?> surface;
|
||||||
|
|
||||||
|
@ -199,6 +200,11 @@ public class BiomeDefinition {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BiomeDefinition setCaves(boolean hasCaves) {
|
||||||
|
this.hasCaves = hasCaves;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Biome build() {
|
public Biome build() {
|
||||||
SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder();
|
SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder();
|
||||||
GenerationSettings.Builder generationSettings = new GenerationSettings.Builder();
|
GenerationSettings.Builder generationSettings = new GenerationSettings.Builder();
|
||||||
|
@ -255,4 +261,8 @@ public class BiomeDefinition {
|
||||||
public float getGenChance() {
|
public float getGenChance() {
|
||||||
return genChance;
|
return genChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCaves() {
|
||||||
|
return hasCaves;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,7 @@ public class BiomeDustWastelands extends EndBiome {
|
||||||
super(new BiomeDefinition("dust_wastelands")
|
super(new BiomeDefinition("dust_wastelands")
|
||||||
.setFogColor(226, 239, 168)
|
.setFogColor(226, 239, 168)
|
||||||
.setFogDensity(2)
|
.setFogDensity(2)
|
||||||
|
.setCaves(false)
|
||||||
.setWaterColor(192, 180, 131)
|
.setWaterColor(192, 180, 131)
|
||||||
.setWaterFogColor(192, 180, 131)
|
.setWaterFogColor(192, 180, 131)
|
||||||
.setSurface(EndBlocks.ENDSTONE_DUST)
|
.setSurface(EndBlocks.ENDSTONE_DUST)
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class BiomePaintedMountains extends EndBiome {
|
||||||
super(new BiomeDefinition("painted_mountains")
|
super(new BiomeDefinition("painted_mountains")
|
||||||
.setFogColor(226, 239, 168)
|
.setFogColor(226, 239, 168)
|
||||||
.setFogDensity(2)
|
.setFogDensity(2)
|
||||||
|
.setCaves(false)
|
||||||
.setWaterColor(192, 180, 131)
|
.setWaterColor(192, 180, 131)
|
||||||
.setWaterFogColor(192, 180, 131)
|
.setWaterFogColor(192, 180, 131)
|
||||||
.setMusic(EndSounds.MUSIC_DUST_WASTELANDS)
|
.setMusic(EndSounds.MUSIC_DUST_WASTELANDS)
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class BiomeSulfurSprings extends EndBiome {
|
||||||
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
||||||
.setFogColor(207, 194, 62)
|
.setFogColor(207, 194, 62)
|
||||||
.setFogDensity(1.5F)
|
.setFogDensity(1.5F)
|
||||||
|
.setCaves(false)
|
||||||
.setParticles(EndParticles.SULPHUR_PARTICLE, 0.001F)
|
.setParticles(EndParticles.SULPHUR_PARTICLE, 0.001F)
|
||||||
.addFeature(EndFeatures.GEYSER)
|
.addFeature(EndFeatures.GEYSER)
|
||||||
.addFeature(EndFeatures.SULPHURIC_LAKE)
|
.addFeature(EndFeatures.SULPHURIC_LAKE)
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class EndBiome {
|
||||||
protected float genChance = 1;
|
protected float genChance = 1;
|
||||||
|
|
||||||
private final float fogDensity;
|
private final float fogDensity;
|
||||||
|
private final boolean hasCaves;
|
||||||
private EndFeature structuresFeature;
|
private EndFeature structuresFeature;
|
||||||
private Biome actualBiome;
|
private Biome actualBiome;
|
||||||
|
|
||||||
|
@ -40,14 +41,16 @@ public class EndBiome {
|
||||||
mcID = definition.getID();
|
mcID = definition.getID();
|
||||||
fogDensity = definition.getFodDensity();
|
fogDensity = definition.getFodDensity();
|
||||||
genChanceUnmutable = definition.getGenChance();
|
genChanceUnmutable = definition.getGenChance();
|
||||||
|
hasCaves = definition.hasCaves();
|
||||||
readStructureList();
|
readStructureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndBiome(Identifier id, Biome biome, float fogDensity, float genChance) {
|
public EndBiome(Identifier id, Biome biome, float fogDensity, float genChance, boolean hasCaves) {
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
this.mcID = id;
|
this.mcID = id;
|
||||||
this.fogDensity = fogDensity;
|
this.fogDensity = fogDensity;
|
||||||
this.genChanceUnmutable = genChance;
|
this.genChanceUnmutable = genChance;
|
||||||
|
this.hasCaves = hasCaves;
|
||||||
readStructureList();
|
readStructureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,4 +168,8 @@ public class EndBiome {
|
||||||
public float getGenChance() {
|
public float getGenChance() {
|
||||||
return this.genChance;
|
return this.genChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCaves() {
|
||||||
|
return hasCaves;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,22 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
||||||
|
brimstone.remove(POS);
|
||||||
|
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||||
|
BlockPos offseted = POS.offset(dir);
|
||||||
|
if (world.getBlockState(offseted).isIn(EndTags.GEN_TERRAIN)) {
|
||||||
|
brimstone.add(offseted);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isDeepWater(world, POS)) {
|
if (isDeepWater(world, POS)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS.move(Direction.DOWN), Blocks.WATER);
|
BlocksHelper.setWithoutUpdate(world, POS.move(Direction.DOWN), Blocks.WATER);
|
||||||
|
brimstone.remove(POS);
|
||||||
|
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||||
|
BlockPos offseted = POS.offset(dir);
|
||||||
|
if (world.getBlockState(offseted).isIn(EndTags.GEN_TERRAIN)) {
|
||||||
|
brimstone.add(offseted);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
brimstone.add(POS.down());
|
brimstone.add(POS.down());
|
||||||
if (random.nextBoolean()) {
|
if (random.nextBoolean()) {
|
||||||
|
@ -179,9 +193,9 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
||||||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||||
BlockPos side;
|
BlockPos side;
|
||||||
if (random.nextInt(4) == 0 && world.getBlockState((side = pos.offset(dir))).getMaterial().isReplaceable()) {
|
if (random.nextInt(3) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||||
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||||
.with(BlockSulphurCrystal.WATERLOGGED, world.getBlockState(side).isOf(Blocks.WATER))
|
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||||
.with(BlockSulphurCrystal.FACING, dir)
|
.with(BlockSulphurCrystal.FACING, dir)
|
||||||
.with(BlockSulphurCrystal.AGE, random.nextInt(3));
|
.with(BlockSulphurCrystal.AGE, random.nextInt(3));
|
||||||
BlocksHelper.setWithoutUpdate(world, side, state);
|
BlocksHelper.setWithoutUpdate(world, side, state);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue