From 549d006cee8e7ace30130a2e7f2dc7bd5edc75dd Mon Sep 17 00:00:00 2001 From: Alice Isabel Date: Thu, 4 Jan 2024 20:50:02 -0300 Subject: [PATCH] Fix a bug where spectator bots would count towards botsDontSleep --- .../org/blocovermelho/bvextension/mixin/BotsDontSleep.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/blocovermelho/bvextension/mixin/BotsDontSleep.java b/src/main/java/org/blocovermelho/bvextension/mixin/BotsDontSleep.java index 26de7a3..8d0ea81 100644 --- a/src/main/java/org/blocovermelho/bvextension/mixin/BotsDontSleep.java +++ b/src/main/java/org/blocovermelho/bvextension/mixin/BotsDontSleep.java @@ -4,6 +4,7 @@ import carpet.patches.EntityPlayerMPFake; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import net.minecraft.server.world.SleepManager; +import net.minecraft.world.GameMode; import org.blocovermelho.bvextension.Settings; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; @@ -26,7 +27,7 @@ public class BotsDontSleep { var players = CarpetServer.minecraft_server.getPlayerManager().getPlayerList(); var bots = (int) players.stream().filter(p -> { - return p instanceof EntityPlayerMPFake; + return p instanceof EntityPlayerMPFake && p.interactionManager.getGameMode() != GameMode.SPECTATOR; }).count(); return original - bots;