diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java | 98 |
1 files changed, 56 insertions, 42 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java index 31a5f36b..fa8d214c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java @@ -68,19 +68,19 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, public FeatureDungeonMap() { super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128, 128); this.setEnabled(false); - parameters.put("scale", new FeatureParameter<Boolean>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); - parameters.put("playerCenter", new FeatureParameter<Boolean>("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); - parameters.put("rotate", new FeatureParameter<Boolean>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); - parameters.put("postScale", new FeatureParameter<Float>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); - parameters.put("useplayerheads", new FeatureParameter<Boolean>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, "boolean")); - parameters.put("showotherplayers", new FeatureParameter<Boolean>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); - parameters.put("showtotalsecrets", new FeatureParameter<Boolean>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); - parameters.put("playerheadscale", new FeatureParameter<Float>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); - parameters.put("textScale", new FeatureParameter<Float>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); - - parameters.put("border_color", new FeatureParameter<AColor>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), "acolor")); - parameters.put("background_color", new FeatureParameter<AColor>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); - parameters.put("player_color", new FeatureParameter<AColor>("player_color", "Color of the player border", "Same as name", new AColor(255, 255, 255, 0), "acolor")); + parameters.put("scale", new FeatureParameter<>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); + parameters.put("playerCenter", new FeatureParameter<>("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); + parameters.put("rotate", new FeatureParameter<>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); + parameters.put("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); + parameters.put("useplayerheads", new FeatureParameter<>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, "boolean")); + parameters.put("showotherplayers", new FeatureParameter<>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); + parameters.put("showtotalsecrets", new FeatureParameter<>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); + parameters.put("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); + parameters.put("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); + + parameters.put("border_color", new FeatureParameter<>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), "acolor")); + parameters.put("background_color", new FeatureParameter<>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); + parameters.put("player_color", new FeatureParameter<>("player_color", "Color of the player border", "Same as name", new AColor(255, 255, 255, 0), "acolor")); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @@ -108,10 +108,10 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, private PlayerComparator() { } - public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) { - ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); - ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); + public int compare(NetworkPlayerInfo compare1, NetworkPlayerInfo compare2) { + ScorePlayerTeam scoreplayerteam = compare1.getPlayerTeam(); + ScorePlayerTeam scoreplayerteam1 = compare2.getPlayerTeam(); + return ComparisonChain.start().compareTrueFirst(compare1.getGameType() != WorldSettings.GameType.SPECTATOR, compare2.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(compare1.getGameProfile().getName(), compare2.getGameProfile().getName()).result(); } } @@ -158,11 +158,21 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, } public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) { - float postScale = this.<Boolean>getParameter("playerCenter").getValue() ? this.<Float>getParameter("postScale").getValue() : 1; + float postScale; + if (this.<Boolean>getParameter("playerCenter").getValue()) { + postScale = this.<Float>getParameter("postScale").getValue(); + } else { + postScale = 1; + } Rectangle featureRect = getFeatureRect().getRectangle(); int width = featureRect.width; - float scale = (this.<Boolean>getParameter("scale").getValue() ? width / 128.0f : 1); - GlStateManager.translate(width / 2, width / 2, 0); + float scale; + if (this.<Boolean>getParameter("scale").getValue()) { + scale = width / 128.0f; + } else { + scale = 1; + } + GlStateManager.translate(width / 2d, width / 2d, 0); GlStateManager.scale(scale, scale, 0); GlStateManager.scale(postScale, postScale, 0); EntityPlayer p = Minecraft.getMinecraft().thePlayer; @@ -178,7 +188,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.translate(-64, -64, 0); } updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); - render(mapData, false); + render(); GlStateManager.enableBlend(); @@ -187,7 +197,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, if (this.<Boolean>getParameter("useplayerheads").getValue()) { renderHeads(mapProcessor, mapData, scale, postScale, partialTicks); } else { - renderArrows(mapProcessor, mapData, scale, postScale, partialTicks); + renderArrows(mapData, scale, postScale); } @@ -197,7 +207,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.pushMatrix(); Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); - GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0); + GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2d, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2d, 0); if (this.<Boolean>getParameter("playerCenter").getValue() && this.<Boolean>getParameter("rotate").getValue()) { GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); @@ -223,7 +233,13 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED ? 0xFF00FF00 : (dungeonRoom.getColor() == 74 ? 0xff000000 : 0xFFFFFFFF)); + if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFF00FF00); + else { + if (dungeonRoom.getColor() == 74) + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xff000000); + else fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFFFFFFFF); + } GlStateManager.popMatrix(); } @@ -318,7 +334,6 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, int i3 = 8 * (flag1 ? -1 : 1); GlStateManager.translate(pt2.x, pt2.y, 0); -// GlStateManager.rotate((float) (yaw2 - 180), 0, 0, 1); GlStateManager.rotate((float) yaw2, 0, 0, 1); GlStateManager.scale(1 / scale, 1 / scale, 0); @@ -377,7 +392,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); - private void renderArrows(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { + private void renderArrows(MapData mapData, float scale, float postScale) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int k = 0; @@ -385,8 +400,8 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, for (Vec4b vec4b : mapData.mapDecorations.values()) { if (vec4b.func_176110_a() == 1 || this.<Boolean>getParameter("showotherplayers").getValue()) { GlStateManager.pushMatrix(); - GlStateManager.translate((float) vec4b.func_176112_b() / 2.0F + 64.0F, (float) vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); - GlStateManager.rotate((float) (vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(vec4b.func_176112_b() / 2.0F + 64.0F, vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); + GlStateManager.rotate((vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); @@ -395,16 +410,15 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.translate(-0.125F, 0.125F, 0.0F); byte b0 = vec4b.func_176110_a(); - float f1 = (float) (b0 % 4) / 4.0F; - float f2 = (float) (b0 / 4) / 4.0F; - float f3 = (float) (b0 % 4 + 1) / 4.0F; - float f4 = (float) (b0 / 4 + 1) / 4.0F; + float f1 = (b0 % 4) / 4.0F; + float f2 = (b0 / 4f) / 4.0F; + float f3 = (b0 % 4 + 1) / 4.0F; + float f4 = (b0 / 4f + 1) / 4.0F; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - float f5 = -0.001F; - worldrenderer.pos(-1.0D, 1.0D, (float) k * -0.001F).tex(f1, f2).endVertex(); - worldrenderer.pos(1.0D, 1.0D, (float) k * -0.001F).tex(f3, f2).endVertex(); - worldrenderer.pos(1.0D, -1.0D, (float) k * -0.001F).tex(f3, f4).endVertex(); - worldrenderer.pos(-1.0D, -1.0D, (float) k * -0.001F).tex(f1, f4).endVertex(); + worldrenderer.pos(-1.0D, 1.0D, k * -0.001F).tex(f1, f2).endVertex(); + worldrenderer.pos(1.0D, 1.0D, k * -0.001F).tex(f3, f2).endVertex(); + worldrenderer.pos(1.0D, -1.0D, k * -0.001F).tex(f3, f4).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, k * -0.001F).tex(f1, f4).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); ++k; @@ -412,7 +426,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, } } - private void render(MapData mapData, boolean noOverlayRendering) { + private void render() { int i = 0; int j = 0; Tessellator tessellator = Tessellator.getInstance(); @@ -423,10 +437,10 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); GlStateManager.disableAlpha(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((float) (i) + f, (float) (j + 128) - f, -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); - worldrenderer.pos((float) (i + 128) - f, (float) (j + 128) - f, -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); - worldrenderer.pos((float) (i + 128) - f, (float) (j) + f, -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); - worldrenderer.pos((float) (i) + f, (float) (j) + f, -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); + worldrenderer.pos((i) + f, (j + 128) - f, -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((i + 128) - f, (j + 128) - f, -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((i + 128) - f, (j) + f, -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((i) + f, (j) + f, -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); |