diff options
author | syeyoung <cyong06@naver.com> | 2021-01-06 15:43:22 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-06 15:43:22 +0900 |
commit | 25bfa1d08f9618a83a3fcee27f71ac924b5d8754 (patch) | |
tree | 7d80a9e078eefa789ecef58a5e72960e82782281 /src/main/java | |
parent | ba793c28fa627ae2ea437b261be56b4cf19fcd8f (diff) | |
download | Skyblock-Dungeons-Guide-25bfa1d08f9618a83a3fcee27f71ac924b5d8754.tar.gz Skyblock-Dungeons-Guide-25bfa1d08f9618a83a3fcee27f71ac924b5d8754.tar.bz2 Skyblock-Dungeons-Guide-25bfa1d08f9618a83a3fcee27f71ac924b5d8754.zip |
A
Diffstat (limited to 'src/main/java')
6 files changed, 42 insertions, 25 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 21a9f66c..fcd31ab8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -28,6 +28,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -119,7 +120,7 @@ public class DungeonListener { } } - @SubscribeEvent + @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST) public void onChatReceived(ClientChatReceivedEvent clientChatReceivedEvent) { try { SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java index 0a7ce483..a0a52454 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java @@ -54,6 +54,9 @@ public class PacketListener extends ChannelDuplexHandler { @SubscribeEvent public void onServerConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + if (event.manager.channel().pipeline().get("dg_packet_handler") != null) + event.manager.channel().pipeline().remove(this); + event.manager.channel().pipeline().addBefore("packet_handler", "dg_packet_handler", this); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java index 192ad10c..947b4dc7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java @@ -41,7 +41,7 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender public void drawScreen(float partialTicks) { if (!isEnabled()) return; GL11.glPushMatrix(); -// GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); GlStateManager.disableFog(); GlStateManager.disableLighting(); clip(new ScaledResolution(Minecraft.getMinecraft()), featureRect.x, featureRect.y, featureRect.width, featureRect.height); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java index 041c0afc..517b668b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java @@ -48,7 +48,7 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen if (item != null) { if (item.getDisplayName() != null && item.getDisplayName().contains("Reward")) { NBTTagCompound tagCompound = item.serializeNBT().getCompoundTag("tag"); - if (tagCompound.hasKey("display", 10)) { + if (tagCompound != null && tagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("display"); if (nbttagcompound.getTagId("Lore") == 9) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java index ff3be74b..697d42eb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java @@ -71,7 +71,6 @@ public class FeatureDungeonDeaths extends GuiFeature implements ChatListener { @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; - System.out.println("HUH"); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); if (context == null) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 4e12399e..c435b331 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; @@ -12,6 +13,7 @@ import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import java.awt.*; @@ -51,39 +53,51 @@ public class GeneralRoomProcessor implements RoomProcessor { } + private int stack = 0; + private long secrets2 = 0; @Override public void actionbarReceived(IChatComponent chat) { - if (dungeonRoom.getTotalSecrets() != -1) return; + if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + if (chat.getFormattedText().contains("-")) return; + if (dungeonRoom.getTotalSecrets() == -1) { + e.sendDebugChat(new ChatComponentText(chat.getFormattedText().replace('§', '&') + " - received")); + } BlockPos pos = Minecraft.getMinecraft().thePlayer.getPosition(); DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); - Point pt1 = context.getMapProcessor().worldPointToRoomPoint(pos.add(2,0,2)); - Point pt2 = context.getMapProcessor().worldPointToRoomPoint(pos.add(-2,0,-2)); + Point pt1 = context.getMapProcessor().worldPointToRoomPoint(pos.add(2, 0, 2)); + Point pt2 = context.getMapProcessor().worldPointToRoomPoint(pos.add(-2, 0, -2)); if (!pt1.equals(pt2)) { + stack = 0; + secrets2 = -1; return; } - - - BlockPos pos2 = dungeonRoom.getMin().add(5,0,5); + BlockPos pos2 = dungeonRoom.getMin().add(5, 0, 5); String text = chat.getFormattedText(); int secretsIndex = text.indexOf("Secrets"); - if (secretsIndex == -1) { - if (FeatureRegistry.DUNGEON_INTERMODCOMM.isEnabled()) - Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac $DG-Comm "+pos2.getX() + "/"+pos2.getZ() + " "+0); - dungeonRoom.setTotalSecrets(0); - return; - } - int theindex = 0; - for (int i = secretsIndex; i > 0; i--) { - if (text.startsWith("§7", i)) { - theindex = i; + int secrets = 0; + if (secretsIndex != -1) { + int theindex = 0; + for (int i = secretsIndex; i >= 0; i--) { + if (text.startsWith("§7", i)) { + theindex = i; + } } + String it = text.substring(theindex + 2, secretsIndex - 1); + secrets = Integer.parseInt(it.split("/")[1]); + } + + if (secrets2 == secrets) stack++; + else { + stack = 0; + secrets2 = secrets; + } + + if (stack == 4 && dungeonRoom.getTotalSecrets() != secrets) { + dungeonRoom.setTotalSecrets(secrets); + if (FeatureRegistry.DUNGEON_INTERMODCOMM.isEnabled()) + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pchat $DG-Comm " + pos2.getX() + "/" + pos2.getZ() + " " + secrets); } - String it = text.substring(theindex + 2, secretsIndex- 1); - int maxSecret = Integer.parseInt(it.split("/")[1]); - dungeonRoom.setTotalSecrets(maxSecret); - if (FeatureRegistry.DUNGEON_INTERMODCOMM.isEnabled()) - Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac $DG-Comm "+pos2.getX() + "/"+pos2.getZ() + " "+maxSecret); } @Override |