mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Added sideness check in SleepingHandler.trySleep(). (#3135)
* Added sideness check in SleepingHandler.trySleep(). * Spaces to tabs correction.
This commit is contained in:
1 parent
601e27c618
commit
f8ca7756b9
1 file changed
+8
-6
@@ -11,18 +11,20 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public final class SleepingHandler {
|
||||
|
||||
|
||||
private SleepingHandler() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void trySleep(PlayerSleepInBedEvent event) {
|
||||
World world = event.getPlayer().world;
|
||||
boolean nearGuardian = ((ServerWorld) world).getEntities()
|
||||
.filter(e -> e instanceof EntityDoppleganger)
|
||||
.anyMatch(e -> ((EntityDoppleganger) e).getPlayersAround().contains(event.getPlayer()));
|
||||
if(!world.isRemote()) {
|
||||
boolean nearGuardian = ((ServerWorld) world).getEntities()
|
||||
.filter(e -> e instanceof EntityDoppleganger)
|
||||
.anyMatch(e -> ((EntityDoppleganger) e).getPlayersAround().contains(event.getPlayer()));
|
||||
|
||||
if(nearGuardian) {
|
||||
event.setResult(PlayerEntity.SleepResult.NOT_SAFE);
|
||||
if(nearGuardian) {
|
||||
event.setResult(PlayerEntity.SleepResult.NOT_SAFE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user