diff options
Diffstat (limited to 'src/main/java/kr/syeyoung')
12 files changed, 120 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java index ba662bbf..80879a9d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java @@ -51,7 +51,10 @@ public class GuiConfig extends GuiScreen { GlStateManager.disableFog(); GlStateManager.color(1,1,1,1); GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); GL11.glPopMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java index 9705351d..fd491705 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java @@ -62,7 +62,10 @@ public class GuiGuiLocationConfig extends GuiScreen { GlStateManager.disableFog(); GlStateManager.color(1,1,1,1); GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); GL11.glPopMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java index 20fe8fa0..d99d2cbb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java @@ -65,6 +65,7 @@ public class GuiParameterConfig extends GuiScreen { GlStateManager.disableFog(); GlStateManager.color(1,1,1,1); GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); int heights = 0; within = null; for (MPanel panel:mainPanel.getChildComponents()) { @@ -83,6 +84,8 @@ public class GuiParameterConfig extends GuiScreen { drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); GlStateManager.popAttrib(); } + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); GL11.glPopMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index 7a6d704f..32f251de 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -1,12 +1,17 @@ package kr.syeyoung.dungeonsguide.dungeon; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; +import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; import net.minecraft.util.IntegerCache; import net.minecraft.world.World; +import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.awt.*; import java.util.*; @@ -49,4 +54,23 @@ public class DungeonContext { mapProcessor.tick(); } + public void onChat(ClientChatReceivedEvent event) { + IChatComponent component = event.message; + if (component.getFormattedText().contains("$DG-Comm")) { + event.setCanceled(true); + String data = component.getFormattedText().substring(component.getFormattedText().indexOf("$DG-Comm")); + String actual = TextUtils.stripColor(data); + String coords = actual.split(" ")[1]; + String secrets = actual.split(" ")[2]; + int x = Integer.parseInt(coords.split("/")[0]); + int z = Integer.parseInt(coords.split("/")[1]); + int secrets2 = Integer.parseInt(secrets); + Point roomPt = mapProcessor.worldPointToRoomPoint(new BlockPos(x,70,z)); + e.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: "+roomPt.x+" / " + roomPt.y + " total secrets "+secrets2)); + DungeonRoom dr = roomMapper.get(roomPt); + if (dr != null) { + dr.setTotalSecrets(secrets2); + } + } + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 7998c893..21a9f66c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -131,6 +131,11 @@ public class DungeonListener { EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + try { + context.onChat(clientChatReceivedEvent); + } catch (Throwable t) { + t.printStackTrace(); + } RoomProcessor roomProcessor = null; try { DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 04e938ab..ea0c05c0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -62,4 +62,6 @@ public class FeatureRegistry { public static final FeatureDungeonSecrets DUNGEON_SECRETS = register(new FeatureDungeonSecrets()); public static final FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs()); public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore()); + public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); + public static final SimpleFeature DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run", "dungeon.intermodcomm", true)); } 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 432f3169..041c0afc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java @@ -36,7 +36,6 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen if (!(rendered.gui instanceof GuiChest)) return; if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; - GL11.glColor4f(1,1,1,1); GlStateManager.disableLighting(); ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java index 024ccb67..a95ed5d2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java @@ -41,7 +41,7 @@ public class FeatureDungeonScore extends GuiFeature { double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; GL11.glScaled(scale, scale, 0); String letter = getLetter(sum); - fr.drawString("Score: "+score + "("+letter+")", 0,0, this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString("Score: "+sum + "("+letter+")", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java new file mode 100644 index 00000000..b96841df --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java @@ -0,0 +1,71 @@ +package kr.syeyoung.dungeonsguide.features.impl; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.List; + + +public class FeatureWarnLowHealth extends GuiFeature { + public FeatureWarnLowHealth() { + super("Dungeon", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 200, 50); + parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of playername", Color.yellow, "color")); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GL11.glScaled(scale, scale, 0); + fr.drawString("DungeonsGuide: ", 0,0,this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString("500hp", fr.getStringWidth("DungeonsGuide: "), 0, Color.red.getRGB()); + } + + @Override + public void drawHUD(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GL11.glScaled(scale, scale, 0); + String lowestHealthName = ""; + int lowestHealth = 999999999; + Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + for (Score sc : scoreboard.getSortedScores(objective)) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); + String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); + if (line.endsWith("❤")) { + String name = stripped.split(" ")[1]; + int health = Integer.parseInt(stripped.split(" ")[2]); + if (health < lowestHealth) { + lowestHealth = health; + lowestHealthName = name; + } + } + } + if (lowestHealth > 500) return; + fr.drawString(lowestHealthName+": ", 0,0,this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString(lowestHealth+"hp", fr.getStringWidth(lowestHealthName+"DungeonsGuide: "), 0, Color.red.getRGB()); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java index 2c1e1889..95410b99 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java @@ -78,6 +78,7 @@ public class MPanel { int relMousey = relMousey0 - getBounds().y; GL11.glTranslated(getBounds().x, getBounds().y, 0); + GL11.glColor4f(1,1,1,0); Rectangle absBound = getBounds().getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java index bc6a0e0f..e4c7d528 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java @@ -173,6 +173,7 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1,1,1,1); GlStateManager.color(1,1,1,1); } private int selected = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index a46ea8cb..4e12399e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -63,9 +63,13 @@ public class GeneralRoomProcessor implements RoomProcessor { } + 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; } @@ -78,6 +82,8 @@ public class GeneralRoomProcessor implements RoomProcessor { 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 |