[Change] removed some deprecated api calls

This commit is contained in:
Frank 2022-07-05 20:09:06 +02:00
parent 19add56099
commit a1175480b3
9 changed files with 33 additions and 14 deletions

View file

@ -23,6 +23,16 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SurfaceRules;
public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
private boolean hasCaves = true;
void setHasCaves(boolean v) {
this.hasCaves = v;
}
public boolean hasCaves() {
return hasCaves;
}
public static class DefaultSurfaceMaterialProvider implements SurfaceMaterialProvider {
public static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
@ -121,7 +131,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
EndBiome biome = builder.build(biomeConfig.getSupplier());
biome.addCustomData("has_caves", biomeConfig.hasCaves());
biome.setHasCaves(biomeConfig.hasCaves());
biome.setSurfaceMaterial(biomeConfig.surfaceMaterial());
EndTags.addBiomeSurfaceToEndGroup(biome);

View file

@ -86,7 +86,7 @@ public class FloatingSpireFeature extends SpireFeature {
sdf.fillRecursive(world, center);
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
if (BiomeAPI.getBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(),

View file

@ -86,7 +86,7 @@ public class SpireFeature extends DefaultFeature {
}).fillRecursive(world, center);
support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
if (BiomeAPI.getBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(),

View file

@ -253,9 +253,12 @@ public abstract class EndCaveFeature extends DefaultFeature {
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
Holder<Biome> biome = world.getBiome(pos.offset(x << 4, 0, z << 4));
BCLBiome endBiome = BiomeAPI.getFromBiome(biome);
boolean hasCaves = endBiome.getCustomData("has_caves", true);
if (!hasCaves && BiomeAPI.wasRegisteredAsEndLandBiome(endBiome.getID())) {
BCLBiome bclBiome = BiomeAPI.getBiome(biome);
boolean hasCaves = true;
if (bclBiome instanceof EndBiome endBiome)
hasCaves = endBiome.hasCaves();
if (!hasCaves && BiomeAPI.wasRegisteredAsEndLandBiome(bclBiome.getID())) {
return true;
}
}

View file

@ -259,7 +259,9 @@ public class TunelCaveFeature extends EndCaveFeature {
protected boolean hasCavesInBiome(WorldGenLevel world, BlockPos pos) {
Holder<Biome> biome = world.getBiome(pos);
BCLBiome endBiome = BiomeAPI.getFromBiome(biome);
return endBiome.getCustomData("has_caves", true);
BCLBiome bclBiome = BiomeAPI.getBiome(biome);
if (bclBiome instanceof EndBiome endBiome)
return endBiome.hasCaves();
return true;
}
}