From d4f348736c7144dcf109b4182134d84276e58d58 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 26 Oct 2020 00:05:01 -0400 Subject: Fix Spirit Boots fix stops working when disconnecting from server Also fix rare crash in blaze puzzle solver --- src/main/java/me/Danker/TheMod.java | 11 ++++------- src/main/java/me/Danker/handlers/PacketHandler.java | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index f5f508a..9f19c97 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -793,7 +793,7 @@ public class TheMod cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); } else if (message.contains("Dungeon starts in 1 second.")) { // Dungeons Stuff - dungeonStartTime = System.currentTimeMillis() / 1000; + dungeonStartTime = System.currentTimeMillis() / 1000 + 1; bloodOpenTime = dungeonStartTime; watcherClearTime = dungeonStartTime; bossClearTime = dungeonStartTime; @@ -1932,7 +1932,7 @@ public class TheMod // Checks 5 times per second if (tickAmount % 4 == 0) { - if (ToggleCommand.blazeToggled && Utils.inDungeons) { + if (ToggleCommand.blazeToggled && Utils.inDungeons && mc.theWorld != null) { List entities = mc.theWorld.getLoadedEntityList(); int highestHealth = 0; highestBlaze = null; @@ -2173,11 +2173,8 @@ public class TheMod @SubscribeEvent public void onServerConnect(ClientConnectedToServerEvent event) { - if (!PacketHandler.added) { - event.manager.channel().pipeline().addBefore("packet_handler", "danker_packet_handler", new PacketHandler()); - PacketHandler.added = true; - System.out.println("Added packet handler to channel pipeline."); - } + event.manager.channel().pipeline().addBefore("packet_handler", "danker_packet_handler", new PacketHandler()); + System.out.println("Added packet handler to channel pipeline."); } public void increaseSeaCreatures() { diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index 56bbc24..ed1c8b0 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -10,8 +10,6 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S04PacketEntityEquipment; public class PacketHandler extends ChannelDuplexHandler { - - public static boolean added = false; @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { -- cgit