Use BCLBiome equals comparison instead of instance comparison. Fixes quiqueck/BetterEnd#88

This commit is contained in:
Necrontyr 2022-10-13 05:38:13 +02:00
parent 01a4bdbe8e
commit 54f1100e22
6 changed files with 16 additions and 16 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.getBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) { if (BiomeAPI.getBiome(world.getBiome(blockPosition())).equals(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.getBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) { if (BiomeAPI.getBiome(world.getBiome(blockPosition())).equals(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

@ -90,12 +90,12 @@ public class EndSlimeEntity extends Slime {
) { ) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
BCLBiome biome = BiomeAPI.getBiome(world.getBiome(blockPosition())); BCLBiome biome = BiomeAPI.getBiome(world.getBiome(blockPosition()));
if (biome == EndBiomes.FOGGY_MUSHROOMLAND) { if (biome.equals(EndBiomes.FOGGY_MUSHROOMLAND)) {
this.setMossy(); this.setMossy();
} else if (biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) { } else if (biome.equals(EndBiomes.MEGALAKE) || biome.equals(EndBiomes.MEGALAKE_GROVE)) {
this.setLake(); this.setLake();
} else if (biome == EndBiomes.AMBER_LAND) { } else if (biome.equals(EndBiomes.AMBER_LAND)) {
this.setAmber(true); this.setAmber();
} }
this.refreshDimensions(); this.refreshDimensions();
return data; return data;
@ -205,7 +205,7 @@ public class EndSlimeEntity extends Slime {
return getSlimeType() == 2; return getSlimeType() == 2;
} }
protected void setAmber(boolean mossy) { protected void setAmber() {
this.entityData.set(VARIANT, (byte) 3); this.entityData.set(VARIANT, (byte) 3);
} }
@ -228,10 +228,10 @@ public class EndSlimeEntity extends Slime {
return false; return false;
} }
BCLBiome biome = BiomeAPI.getBiome(world.getBiome(pos)); BCLBiome biome = BiomeAPI.getBiome(world.getBiome(pos));
if (biome == EndBiomes.CHORUS_FOREST || biome == EndBiomes.MEGALAKE) { if (biome.equals(EndBiomes.CHORUS_FOREST) || biome.equals(EndBiomes.MEGALAKE)) {
return true; return true;
} }
if (biome == EndBiomes.MEGALAKE_GROVE && random.nextBoolean()) { if (biome.equals(EndBiomes.MEGALAKE_GROVE) && random.nextBoolean()) {
return true; return true;
} }
return random.nextInt(4) == 0 && isWaterNear(world, pos); return random.nextInt(4) == 0 && isWaterNear(world, pos);

View file

@ -92,15 +92,15 @@ public class LootTableUtil {
public static ResourceLocation getTable(Holder<Biome> biome) { public static ResourceLocation getTable(Holder<Biome> biome) {
BCLBiome bclBiome = BiomeAPI.getBiome(biome.value()); BCLBiome bclBiome = BiomeAPI.getBiome(biome.value());
if (bclBiome == EndBiomes.FOGGY_MUSHROOMLAND) { if (bclBiome.equals(EndBiomes.FOGGY_MUSHROOMLAND)) {
return FOGGY_MUSHROOMLAND; return FOGGY_MUSHROOMLAND;
} else if (bclBiome == EndBiomes.CHORUS_FOREST) { } else if (bclBiome.equals(EndBiomes.CHORUS_FOREST)) {
return CHORUS_FOREST; return CHORUS_FOREST;
} else if (bclBiome == EndBiomes.SHADOW_FOREST) { } else if (bclBiome.equals(EndBiomes.SHADOW_FOREST)) {
return SHADOW_FOREST; return SHADOW_FOREST;
} else if (bclBiome == EndBiomes.LANTERN_WOODS) { } else if (bclBiome.equals(EndBiomes.LANTERN_WOODS)) {
return LANTERN_WOODS; return LANTERN_WOODS;
} else if (bclBiome == EndBiomes.UMBRELLA_JUNGLE) { } else if (bclBiome.equals(EndBiomes.UMBRELLA_JUNGLE)) {
return UMBRELLA_JUNGLE; return UMBRELLA_JUNGLE;
} }
return COMMON; return COMMON;

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.getBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) { if (BiomeAPI.getBiome(world.getBiome(bpos)).equals(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.getBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) { if (BiomeAPI.getBiome(world.getBiome(bpos)).equals(EndBiomes.BLOSSOMING_SPIRES)) {
EndFeatures.TENANEA_BUSH.getFeature() EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<NoneFeatureConfiguration>( .place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),