Skip to content

Commit

Permalink
Update Firefly.java
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Dec 29, 2024
1 parent bb3c2fd commit aa6df70
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/net/frozenblock/wilderwild/entity/Firefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@

public class Firefly extends PathfinderMob implements FlyingAnimal, Bottleable {
public static final int RANDOM_FLICKER_AGE_MAX = 19;
public static final int SPAWN_CHANCE = 75;
private static final EntityDataAccessor<Boolean> FROM_BOTTLE = SynchedEntityData.defineId(Firefly.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Integer> AGE = SynchedEntityData.defineId(Firefly.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Float> ANIM_SCALE = SynchedEntityData.defineId(Firefly.class, EntityDataSerializers.FLOAT);
Expand Down Expand Up @@ -114,14 +113,12 @@ public static boolean checkFireflySpawnRules(
) {
if (!MobSpawnType.isSpawner(spawnType) && !WWEntityConfig.get().firefly.spawnFireflies) return false;
if (MobSpawnType.ignoresLightRequirements(spawnType)) return true;
boolean chance = random.nextInt(0, SPAWN_CHANCE) == 0;
Holder<Biome> biomeHolder = level.getBiome(pos);
if (biomeHolder.is(WWBiomeTags.FIREFLY_SPAWNABLE_CAVE)) {
return chance && level.getBrightness(LightLayer.SKY, pos) == 0;
return level.getBrightness(LightLayer.SKY, pos) == 0;
}
return chance &&
((biomeHolder.is(WWBiomeTags.FIREFLY_SPAWNABLE_DURING_DAY) && level.getBrightness(LightLayer.SKY, pos) >= 6)
|| ((!level.dimensionType().hasFixedTime() && level.getSkyDarken() > 4) && level.canSeeSky(pos)));
return biomeHolder.is(WWBiomeTags.FIREFLY_SPAWNABLE_DURING_DAY) && level.getBrightness(LightLayer.SKY, pos) >= 6
|| !level.dimensionType().hasFixedTime() && level.getSkyDarken() > 4 && level.canSeeSky(pos);
}

@NotNull
Expand Down

0 comments on commit aa6df70

Please sign in to comment.