Fixes & improvements

This commit is contained in:
paulevsGitch 2020-12-02 04:14:07 +03:00
parent b375d76956
commit 10fae49f6a
10 changed files with 51 additions and 15 deletions

View file

@ -48,16 +48,15 @@ public class BlockBrimstone extends BlockBase {
BlockPos side = pos.offset(dir);
BlockState sideState = world.getBlockState(side);
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;
world.setBlockState(side, sideState.with(BlockSulphurCrystal.AGE, age));
}
}
else if (sideState.isAir() || !sideState.getFluidState().isEmpty()) {
boolean water = sideState.getFluidState().getFluid().equals(Fluids.WATER);
else if (sideState.getFluidState().getFluid() == Fluids.WATER) {
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
.with(BlockSulphurCrystal.FACING, dir)
.with(BlockSulphurCrystal.WATERLOGGED, water)
.with(BlockSulphurCrystal.WATERLOGGED, true)
.with(BlockSulphurCrystal.AGE, 0);
world.setBlockState(side, crystal);
}

View file

@ -96,13 +96,15 @@ public class EndBiomes {
float fog = 1F;
float chance = 1F;
boolean isVoid = false;
boolean hasCaves = true;
JsonElement element = config.get(id.getPath());
if (element != null && element.isJsonObject()) {
fog = JsonFactory.getFloat(element.getAsJsonObject(), "fogDensity", 1);
chance = JsonFactory.getFloat(element.getAsJsonObject(), "genChance", 1);
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) {
VOID_BIOMES.addBiomeMutable(endBiome);
}
@ -175,7 +177,7 @@ public class EndBiomes {
* @return registered {@link EndBiome}
*/
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);
return endBiome;
}
@ -187,8 +189,8 @@ public class EndBiomes {
* @param genChance - generation chance [0.0F - Infinity]
* @return registered {@link EndBiome}
*/
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float genChance) {
return registerSubBiome(biome, parent, 1, genChance);
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float genChance, boolean hasCaves) {
return registerSubBiome(biome, parent, 1, genChance, hasCaves);
}
/**
@ -199,8 +201,8 @@ public class EndBiomes {
* @param genChance - generation chance [0.0F - Infinity]
* @return registered {@link EndBiome}
*/
public static EndBiome registerSubBiome(Biome biome, EndBiome parent, float fogDensity, float genChance) {
EndBiome endBiome = new EndBiome(BuiltinRegistries.BIOME.getId(biome), biome, fogDensity, 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, hasCaves);
parent.addSubBiome(endBiome);
SUBBIOMES.add(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) {
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) {

View file

@ -125,7 +125,7 @@ public class EndFeatures {
addFeature(ENDER_ORE, features);
addFeature(CRASHED_SHIP, features);
if (!id.getPath().equals("blossoming_spires")) {
if (EndBiomes.getBiome(id).hasCaves()) {
addFeature(ROUND_CAVE_RARE, features);
addFeature(CAVE_GRASS, features);
}

View file

@ -11,6 +11,7 @@ public class BiomeBlossomingSpires extends EndBiome {
.setFogColor(241, 146, 229)
.setFogDensity(1.7F)
.setPlantsColor(122, 45, 122)
.setCaves(false)
.setSurface(EndBlocks.PINK_MOSS)
.setMusic(EndSounds.MUSIC_BLOSSOMING_SPIRES)
.setLoop(EndSounds.AMBIENT_BLOSSOMING_SPIRES)

View file

@ -59,6 +59,7 @@ public class BiomeDefinition {
private final Identifier id;
private float genChance = 1F;
private boolean hasCaves = true;
private ConfiguredSurfaceBuilder<?> surface;
@ -198,6 +199,11 @@ public class BiomeDefinition {
this.music = music;
return this;
}
public BiomeDefinition setCaves(boolean hasCaves) {
this.hasCaves = hasCaves;
return this;
}
public Biome build() {
SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder();
@ -255,4 +261,8 @@ public class BiomeDefinition {
public float getGenChance() {
return genChance;
}
public boolean hasCaves() {
return hasCaves;
}
}

View file

@ -11,6 +11,7 @@ public class BiomeDustWastelands extends EndBiome {
super(new BiomeDefinition("dust_wastelands")
.setFogColor(226, 239, 168)
.setFogDensity(2)
.setCaves(false)
.setWaterColor(192, 180, 131)
.setWaterFogColor(192, 180, 131)
.setSurface(EndBlocks.ENDSTONE_DUST)

View file

@ -11,6 +11,7 @@ public class BiomePaintedMountains extends EndBiome {
super(new BiomeDefinition("painted_mountains")
.setFogColor(226, 239, 168)
.setFogDensity(2)
.setCaves(false)
.setWaterColor(192, 180, 131)
.setWaterFogColor(192, 180, 131)
.setMusic(EndSounds.MUSIC_DUST_WASTELANDS)

View file

@ -11,6 +11,7 @@ public class BiomeSulfurSprings extends EndBiome {
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
.setFogColor(207, 194, 62)
.setFogDensity(1.5F)
.setCaves(false)
.setParticles(EndParticles.SULPHUR_PARTICLE, 0.001F)
.addFeature(EndFeatures.GEYSER)
.addFeature(EndFeatures.SULPHURIC_LAKE)

View file

@ -32,6 +32,7 @@ public class EndBiome {
protected float genChance = 1;
private final float fogDensity;
private final boolean hasCaves;
private EndFeature structuresFeature;
private Biome actualBiome;
@ -40,14 +41,16 @@ public class EndBiome {
mcID = definition.getID();
fogDensity = definition.getFodDensity();
genChanceUnmutable = definition.getGenChance();
hasCaves = definition.hasCaves();
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.mcID = id;
this.fogDensity = fogDensity;
this.genChanceUnmutable = genChance;
this.hasCaves = hasCaves;
readStructureList();
}
@ -165,4 +168,8 @@ public class EndBiome {
public float getGenChance() {
return this.genChance;
}
public boolean hasCaves() {
return hasCaves;
}
}

View file

@ -92,8 +92,22 @@ public class SulphuricLakeFeature extends DefaultFeature {
}
else {
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)) {
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());
if (random.nextBoolean()) {
@ -179,9 +193,9 @@ public class SulphuricLakeFeature extends DefaultFeature {
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
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()
.with(BlockSulphurCrystal.WATERLOGGED, world.getBlockState(side).isOf(Blocks.WATER))
.with(BlockSulphurCrystal.WATERLOGGED, true)
.with(BlockSulphurCrystal.FACING, dir)
.with(BlockSulphurCrystal.AGE, random.nextInt(3));
BlocksHelper.setWithoutUpdate(world, side, state);