Skip to content

Commit

Permalink
skip iterating entities if radiation is background level
Browse files Browse the repository at this point in the history
  • Loading branch information
thiakil committed Jan 16, 2025
1 parent 6cc0109 commit 5926dce
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,13 @@ private void burnFuel(Level world) {
private void radiateEntities(Level world) {
IRadiationManager radiationManager = IRadiationManager.INSTANCE;
if (radiationManager.isRadiationEnabled() && isBurning() && world.getRandom().nextInt() % SharedConstants.TICKS_PER_SECOND == 0) {
double wasteRadiation = getWasteTankRadioactivity(false) / 3_600F; // divide down to Sv/s
double magnitude = lastBurnRate + wasteRadiation;
if (magnitude <= RadiationManager.BASELINE) {
return;
}
List<LivingEntity> entitiesToRadiate = getLevel().getEntitiesOfClass(LivingEntity.class, hotZone);
if (!entitiesToRadiate.isEmpty()) {
double wasteRadiation = getWasteTankRadioactivity(false) / 3_600F; // divide down to Sv/s
double magnitude = lastBurnRate + wasteRadiation;
for (LivingEntity entity : entitiesToRadiate) {
radiationManager.radiate(entity, magnitude);
}
Expand Down

0 comments on commit 5926dce

Please sign in to comment.