[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

@ -51,7 +51,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
) { ) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) { if (BiomeAPI.getBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
this.entityData.set(VARIANT, (byte) 1); this.entityData.set(VARIANT, (byte) 1);
} }

View file

@ -59,7 +59,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
) { ) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) { if (BiomeAPI.getBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL)); this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL));
} }

View file

@ -89,7 +89,7 @@ public class EndSlimeEntity extends Slime {
CompoundTag entityTag CompoundTag entityTag
) { ) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
BCLBiome biome = BiomeAPI.getFromBiome(world.getBiome(blockPosition())); BCLBiome biome = BiomeAPI.getBiome(world.getBiome(blockPosition()));
if (biome == EndBiomes.FOGGY_MUSHROOMLAND) { if (biome == EndBiomes.FOGGY_MUSHROOMLAND) {
this.setMossy(); this.setMossy();
} else if (biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) { } else if (biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) {
@ -227,7 +227,7 @@ public class EndSlimeEntity extends Slime {
if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES)) { if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES)) {
return false; return false;
} }
BCLBiome biome = BiomeAPI.getFromBiome(world.getBiome(pos)); BCLBiome biome = BiomeAPI.getBiome(world.getBiome(pos));
if (biome == EndBiomes.CHORUS_FOREST || biome == EndBiomes.MEGALAKE) { if (biome == EndBiomes.CHORUS_FOREST || biome == EndBiomes.MEGALAKE) {
return true; return true;
} }

View file

@ -1223,8 +1223,12 @@ public class EndFeatures {
BiomeAPI.addBiomeFeature(biome, feature); BiomeAPI.addBiomeFeature(biome, feature);
} }
boolean hasCaves = bclbiome.getCustomData("has_caves", true) && !(bclbiome instanceof EndCaveBiome);
//TODO: 1.19 Test Cave generation boolean hasCaves = !(bclbiome instanceof EndCaveBiome);
if (!(bclbiome instanceof EndCaveBiome) && bclbiome instanceof EndBiome endBiome) {
hasCaves = endBiome.hasCaves();
}
if (hasCaves && !BiomeAPI.wasRegisteredAsEndVoidBiome(id) /*!BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(id)*/) { if (hasCaves && !BiomeAPI.wasRegisteredAsEndVoidBiome(id) /*!BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(id)*/) {
if (Configs.BIOME_CONFIG.getBoolean(id, "hasCaves", true)) { if (Configs.BIOME_CONFIG.getBoolean(id, "hasCaves", true)) {
BiomeAPI.addBiomeFeature(biome, ROUND_CAVE); BiomeAPI.addBiomeFeature(biome, ROUND_CAVE);

View file

@ -23,6 +23,16 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SurfaceRules; import net.minecraft.world.level.levelgen.SurfaceRules;
public class EndBiome extends BCLBiome implements SurfaceMaterialProvider { 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 class DefaultSurfaceMaterialProvider implements SurfaceMaterialProvider {
public static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState(); 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()); EndBiome biome = builder.build(biomeConfig.getSupplier());
biome.addCustomData("has_caves", biomeConfig.hasCaves()); biome.setHasCaves(biomeConfig.hasCaves());
biome.setSurfaceMaterial(biomeConfig.surfaceMaterial()); biome.setSurfaceMaterial(biomeConfig.surfaceMaterial());
EndTags.addBiomeSurfaceToEndGroup(biome); EndTags.addBiomeSurfaceToEndGroup(biome);

View file

@ -86,7 +86,7 @@ public class FloatingSpireFeature extends SpireFeature {
sdf.fillRecursive(world, center); sdf.fillRecursive(world, center);
support.forEach((bpos) -> { 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() EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<NoneFeatureConfiguration>( .place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),

View file

@ -86,7 +86,7 @@ public class SpireFeature extends DefaultFeature {
}).fillRecursive(world, center); }).fillRecursive(world, center);
support.forEach((bpos) -> { 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() EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<NoneFeatureConfiguration>( .place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),

View file

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

View file

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