mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-01-31 19:16:44 +01:00
Fixed day ponies sleeping being sent to the next night
This commit is contained in:
parent
75a0c4d769
commit
00604eb485
2 changed files with 13 additions and 1 deletions
|
@ -76,6 +76,10 @@ public record Race (boolean canCast, FlightType flightType, boolean canUseEarth,
|
|||
return this == UNSET || this == HUMAN;
|
||||
}
|
||||
|
||||
public boolean isDayurnal() {
|
||||
return !isNocturnal();
|
||||
}
|
||||
|
||||
public boolean isOp() {
|
||||
return this == ALICORN;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.minelittlepony.unicopia.server.world;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.server.world.SleepManager;
|
||||
|
@ -28,7 +32,11 @@ public class NocturnalSleepManager extends SleepManager {
|
|||
}
|
||||
|
||||
public void skipTime() {
|
||||
if (world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
||||
if (world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE) && world.getPlayers().stream()
|
||||
.filter(LivingEntity::isSleeping)
|
||||
.map(Pony::of)
|
||||
.map(Pony::getActualSpecies)
|
||||
.noneMatch(Race::isDayurnal)) {
|
||||
world.setTimeOfDay(world.getLevelProperties().getTimeOfDay() - DAY_LENGTH + 13500);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue