diff --git a/changelog.md b/changelog.md index bfc3b45ac..9526dc6e2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,2 @@ -- fixed bug with game stages not reloading properly in the configuration file (reported by @Sully) -- fixed game crash caused by compatibility issues with Loot Beams mod (reported by @davey) -- fixed game crash when breaking chest with Cursed Armor inside (reported by @Jabkkm) \ No newline at end of file +- fixed game crash during Undead Army (reported by @NotTohm) +- fixed game crash caused by Blood Moon (reported by @ZacGames) \ No newline at end of file diff --git a/common/src/main/java/com/majruszsdifficulty/bloodmoon/listeners/Trigger.java b/common/src/main/java/com/majruszsdifficulty/bloodmoon/listeners/Trigger.java index 94e40aac7..0810c2de2 100644 --- a/common/src/main/java/com/majruszsdifficulty/bloodmoon/listeners/Trigger.java +++ b/common/src/main/java/com/majruszsdifficulty/bloodmoon/listeners/Trigger.java @@ -7,6 +7,8 @@ import com.majruszsdifficulty.bloodmoon.BloodMoonHelper; import net.minecraft.world.level.Level; +import java.util.Optional; + public class Trigger { static { OnServerTicked.listen( Trigger::start ) @@ -29,6 +31,6 @@ private static void finish( OnServerTicked data ) { } private static long getTime() { - return Side.getServer().overworld().getDayTime() % Level.TICKS_PER_DAY; + return Optional.ofNullable( Side.getServer() ).map( server->server.overworld().getDayTime() % Level.TICKS_PER_DAY ).orElse( 0L ); } } diff --git a/common/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java b/common/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java index 94fb195f0..4ffe8ccec 100644 --- a/common/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java +++ b/common/src/main/java/com/majruszsdifficulty/undeadarmy/UndeadArmy.java @@ -143,8 +143,9 @@ public boolean isPartOfWave( Entity entity ) { private void forEachSpawnedUndead( Consumer< LivingEntity > consumer ) { this.mobsLeft.stream() - .filter( mobInfo->mobInfo.uuid != null ) - .forEach( mobInfo->consumer.accept( ( LivingEntity )mobInfo.toEntity( this.getLevel() ) ) ); + .map( mobInfo->mobInfo.toEntity( this.getLevel() ) ) + .filter( entity->entity != null ) + .forEach( entity->consumer.accept( ( LivingEntity )entity ) ); } public ServerLevel getLevel() { diff --git a/gradle.properties b/gradle.properties index de45b7924..5a070cc8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ minecraft_version=1.20.1 # Mod mod_id=majruszsdifficulty mod_archives_name=majruszs-difficulty -mod_version=1.9.4 +mod_version=1.9.5 mod_display_name=Majrusz's Progressive Difficulty mod_description=Mod that progressively increases the game difficulty over time. mod_authors=Majrusz