From 0769dd5ff85fda912a52f8cc602bc484d85165c8 Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Mon, 3 Oct 2022 20:46:26 +0200 Subject: fix dungeon map not showing ppl heads --- .../features/impl/dungeon/FeatureDungeonMap.java | 34 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src') 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 e5d41de3..d9cb27a1 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 @@ -20,12 +20,12 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.*; @@ -55,8 +55,10 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import java.awt.*; -import java.util.List; import java.util.Comparator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { public FeatureDungeonMap() { @@ -267,15 +269,37 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, this.mapTexture.updateDynamicTexture(); } + final Pattern pattern = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); + + + private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { List list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); if (list.size() < 40) return; for (int i = 1; i < 20; i++) { NetworkPlayerInfo networkPlayerInfo = list.get(i); String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName()); + if (name.trim().equals("§r") || name.startsWith("§r ")) continue; - String actual = TextUtils.stripColor(name).trim().split(" ")[0]; - EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(actual); + + name = TextUtils.stripColor(name); + + name = name.replaceAll(" ", "*"); + + + Matcher matcher = pattern.matcher(name); + + if(!matcher.find()) continue; + + name = matcher.group(0); + + name = name.substring(0, name.length() - 1); + + name = name.substring(1); + + + EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); + if (TextUtils.stripColor(name).endsWith("(DEAD)") && entityplayer != Minecraft.getMinecraft().thePlayer) { continue; } @@ -286,7 +310,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks)); yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; } else { - String iconName = mapProcessor.getMapIconToPlayerMap().get(actual); + String iconName = mapProcessor.getMapIconToPlayerMap().get(name); if (iconName == null) continue; Vec4b vec = mapData.mapDecorations.get(iconName); if (vec == null) { -- cgit From 0eded8ba2270b9cd49db6527978567d69ce7c32b Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Tue, 4 Oct 2022 16:43:40 +0200 Subject: fix the code not checking if player is not dead --- .../features/impl/dungeon/FeatureDungeonMap.java | 193 ++++++++++++--------- 1 file changed, 108 insertions(+), 85 deletions(-) (limited to 'src') 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 d9cb27a1..39fde917 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 @@ -51,6 +51,7 @@ import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.MapData; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -62,7 +63,7 @@ import java.util.regex.Pattern; public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { public FeatureDungeonMap() { - super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128,128); + super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128, 128); this.setEnabled(false); 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")); @@ -74,9 +75,9 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, 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("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")); + 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(); @@ -100,40 +101,39 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, } @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator - { - private PlayerComparator() - { + static class PlayerComparator implements Comparator { + private PlayerComparator() { } - public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) - { + 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(); } } + @Override public void drawHUD(float partialTicks) { if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; + if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) + return; if (!on) return; DungeonContext context = skyblockStatus.getContext(); MapProcessor mapProcessor = context.getMapProcessor(); MapData mapData = mapProcessor.getLastMapData2(); - Rectangle featureRect =getFeatureRect().getRectangle(); - Gui.drawRect(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.getParameter("background_color").getValue())); - GlStateManager.color(1,1,1,1); + Rectangle featureRect = getFeatureRect().getRectangle(); + Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.getParameter("background_color").getValue())); + GlStateManager.color(1, 1, 1, 1); GlStateManager.pushMatrix(); if (mapData == null) { - Gui.drawRect(0,0,featureRect.width, featureRect.height, 0xFFFF0000); + Gui.drawRect(0, 0, featureRect.width, featureRect.height, 0xFFFF0000); } else { - renderMap(partialTicks,mapProcessor,mapData,context); + renderMap(partialTicks, mapProcessor, mapData, context); } GlStateManager.popMatrix(); GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0,0,featureRect.width, featureRect.height, this.getParameter("border_color").getValue()); + RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.getParameter("border_color").getValue()); } @Override @@ -142,8 +142,8 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, drawHUD(partialTicks); return; } - Rectangle featureRect =getFeatureRect().getRectangle(); - Gui.drawRect(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.getParameter("background_color").getValue())); + Rectangle featureRect = getFeatureRect().getRectangle(); + Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.getParameter("background_color").getValue())); FontRenderer fr = getFontRenderer(); GlStateManager.enableBlend(); @@ -151,27 +151,27 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); fr.drawString("Please join a dungeon to see preview", featureRect.width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, featureRect.height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0,0,featureRect.width, featureRect.height, this.getParameter("border_color").getValue()); + RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.getParameter("border_color").getValue()); } - public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context){ + public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) { float postScale = this.getParameter("playerCenter").getValue() ? this.getParameter("postScale").getValue() : 1; - Rectangle featureRect =getFeatureRect().getRectangle(); + Rectangle featureRect = getFeatureRect().getRectangle(); int width = featureRect.width; float scale = (this.getParameter("scale").getValue() ? width / 128.0f : 1); GlStateManager.translate(width / 2, width / 2, 0); GlStateManager.scale(scale, scale, 0); - GlStateManager.scale(postScale, postScale,0); + GlStateManager.scale(postScale, postScale, 0); EntityPlayer p = Minecraft.getMinecraft().thePlayer; Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; if (this.getParameter("playerCenter").getValue()) { if (this.getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (180.0 - yaw), 0,0,1); + GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); } - GlStateManager.translate( -pt.x, -pt.y, 0); + GlStateManager.translate(-pt.x, -pt.y, 0); } else { - GlStateManager.translate( -64, -64, 0); + GlStateManager.translate(-64, -64, 0); } updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); render(mapData, false); @@ -201,7 +201,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); float s = this.getParameter("textScale").getValue(); - GlStateManager.scale(s,s,0); + GlStateManager.scale(s, s, 0); String str = ""; str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); str += " "; @@ -228,7 +228,6 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, } - private final DynamicTexture mapTexture = new DynamicTexture(128, 128); private final ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); private final int[] mapTextureData = mapTexture.getTextureData(); @@ -269,40 +268,23 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, this.mapTexture.updateDynamicTexture(); } - final Pattern pattern = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); - - private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { List list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); if (list.size() < 40) return; + + // 19 iterations bc we only want to scan the player part of tab list for (int i = 1; i < 20; i++) { NetworkPlayerInfo networkPlayerInfo = list.get(i); - String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName()); - - if (name.trim().equals("§r") || name.startsWith("§r ")) continue; - - name = TextUtils.stripColor(name); - - name = name.replaceAll(" ", "*"); - - Matcher matcher = pattern.matcher(name); - - if(!matcher.find()) continue; - - name = matcher.group(0); - - name = name.substring(0, name.length() - 1); - - name = name.substring(1); + String name = getPlayerName(networkPlayerInfo); + if (name == null) continue; EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); - if (TextUtils.stripColor(name).endsWith("(DEAD)") && entityplayer != Minecraft.getMinecraft().thePlayer) { - continue; - } + if (entityplayer != Minecraft.getMinecraft().thePlayer) continue; + Point pt2; double yaw2; @@ -317,12 +299,15 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, continue; } else { pt2 = new Point(vec.func_176112_b() / 2 + 64, vec.func_176113_c() / 2 + 64); - yaw2 = vec.func_176111_d() * 360 / 16.0f ; + yaw2 = vec.func_176111_d() * 360 / 16.0f; } } + GlStateManager.pushMatrix(); - if (entityplayer == Minecraft.getMinecraft().thePlayer || this.getParameter("showotherplayers").getValue()) - { + + boolean showOtherPlayers = this.getParameter("showotherplayers").getValue(); + + if (entityplayer == Minecraft.getMinecraft().thePlayer || showOtherPlayers) { boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); GlStateManager.enableTexture2D(); Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); @@ -335,14 +320,52 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); float s = this.getParameter("playerheadscale").getValue(); - GlStateManager.scale(s,s,0); + GlStateManager.scale(s, s, 0); Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); GL11.glLineWidth(1); - RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.getParameter("player_color").getValue()); + RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.getParameter("player_color").getValue()); } GlStateManager.popMatrix(); } } + + final Pattern tabListRegex = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); + + /** + * We make sure that the player is alive and regex their name out + * @param networkPlayerInfo the network player info of player + * @return the username of player + */ + @Nullable + private String getPlayerName(NetworkPlayerInfo networkPlayerInfo) { + String name; + if (networkPlayerInfo.getDisplayName() != null) { + name = networkPlayerInfo.getDisplayName().getFormattedText(); + } else { + name = ScorePlayerTeam.formatPlayerName( + networkPlayerInfo.getPlayerTeam(), + networkPlayerInfo.getGameProfile().getName() + ); + } + + if (name.trim().equals("§r") || name.startsWith("§r ")) return null; + + name = TextUtils.stripColor(name); + + if(name.contains("(DEAD)")) return null; + + name = name.replace(" ", "*"); + + Matcher matcher = tabListRegex.matcher(name); + if (!matcher.find()) return null; + + name = matcher.group(0); + name = name.substring(0, name.length() - 1); + name = name.substring(1); + return name; + } + + 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) { @@ -351,32 +374,32 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, int k = 0; Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); for (Vec4b vec4b : mapData.mapDecorations.values()) { - if (vec4b.func_176110_a() == 1 || this.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.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.getParameter("playerheadscale").getValue(); - GlStateManager.scale(s * 5,s * 5,0); - - 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; - 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(); - tessellator.draw(); - GlStateManager.popMatrix(); - ++k; - } + if (vec4b.func_176110_a() == 1 || this.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.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + float s = this.getParameter("playerheadscale").getValue(); + GlStateManager.scale(s * 5, s * 5, 0); + + 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; + 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(); + tessellator.draw(); + GlStateManager.popMatrix(); + ++k; + } } } @@ -391,10 +414,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((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(); tessellator.draw(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); -- cgit From 448e5b54187718c4edf44f177b28182fab6d8506 Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Tue, 4 Oct 2022 19:30:36 +0200 Subject: un-rotate the heads on map (it was the wrong way) --- .../dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 39fde917..be28fc34 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 @@ -315,7 +315,8 @@ 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 - 180), 0, 0, 1); + GlStateManager.rotate((float) yaw2, 0, 0, 1); GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); -- cgit From a89ce55ece94804500ce824446dae816e2119402 Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Tue, 4 Oct 2022 19:34:24 +0200 Subject: remove unnecessary yaw interpolation that caused weird jutter turn the position from ints to floats, so it doesn't jump --- .../syeyoung/dungeonsguide/dungeon/MapProcessor.java | 18 ++++++++++++------ .../features/impl/dungeon/FeatureDungeonMap.java | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index b6089ebd..8f9ae312 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -22,19 +22,18 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; import kr.syeyoung.dungeonsguide.dungeon.events.SerializableBlockPos; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; import kr.syeyoung.dungeonsguide.events.DungeonContextInitializationEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.stomp.StompPayload; import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.wsresource.StaticResource; import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; import lombok.Getter; import lombok.Setter; @@ -48,11 +47,10 @@ import net.minecraftforge.common.MinecraftForge; import org.json.JSONObject; import javax.vecmath.Vector2d; -import javax.vecmath.Vector2f; import java.awt.*; -import java.util.*; import java.util.List; -import java.util.concurrent.ExecutionException; +import java.util.Queue; +import java.util.*; public class MapProcessor { @@ -210,6 +208,14 @@ public class MapProcessor { if (context.getDungeonMin() == null) return null; return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32); } + + public Vector2d worldPointToMapPointFLOAT(Vec3 worldPoint) { + if (context.getDungeonMin() == null) return null; + double x = topLeftMapPoint.x + ((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)); + double y = topLeftMapPoint.y + ((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height)); + return new Vector2d(x, y); + } + public Point worldPointToMapPoint(Vec3 worldPoint) { if (context.getDungeonMin() == null) return null; return new Point(topLeftMapPoint.x + (int)((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)), topLeftMapPoint.y + (int)((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height))); 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 be28fc34..557232c5 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 @@ -163,8 +163,9 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(scale, scale, 0); GlStateManager.scale(postScale, postScale, 0); EntityPlayer p = Minecraft.getMinecraft().thePlayer; - Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); - double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; + + Vector2d pt = mapProcessor.worldPointToMapPointFLOAT(p.getPositionEyes(partialTicks)); + double yaw = p.rotationYaw; if (this.getParameter("playerCenter").getValue()) { if (this.getParameter("rotate").getValue()) { GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); @@ -283,13 +284,12 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); - if (entityplayer != Minecraft.getMinecraft().thePlayer) continue; - - Point pt2; + Vector2d pt2; double yaw2; + if (entityplayer != null && (!entityplayer.isInvisible() || entityplayer == Minecraft.getMinecraft().thePlayer)) { - pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks)); + pt2 = mapProcessor.worldPointToMapPointFLOAT(entityplayer.getPositionEyes(partialTicks)); yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; } else { String iconName = mapProcessor.getMapIconToPlayerMap().get(name); @@ -298,7 +298,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, if (vec == null) { continue; } else { - pt2 = new Point(vec.func_176112_b() / 2 + 64, vec.func_176113_c() / 2 + 64); + pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64); yaw2 = vec.func_176111_d() * 360 / 16.0f; } } @@ -320,9 +320,12 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); + float s = this.getParameter("playerheadscale").getValue(); GlStateManager.scale(s, s, 0); - Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); + + // cutting out the player head out of the skin texture + Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, l2, 8, i3, 8, 8, 64.0F, 64.0F); GL11.glLineWidth(1); RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.getParameter("player_color").getValue()); } -- cgit From 084217509ee76aae19165edc1f4e79cdfa6ce141 Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Tue, 4 Oct 2022 19:35:06 +0200 Subject: reimplement check if player dead --- .../features/impl/dungeon/FeatureDungeonMap.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') 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 557232c5..31a5f36b 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 @@ -28,7 +28,9 @@ import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; +import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.block.material.MapColor; @@ -55,6 +57,7 @@ import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import javax.vecmath.Vector2d; import java.awt.*; import java.util.Comparator; import java.util.List; @@ -278,7 +281,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, for (int i = 1; i < 20; i++) { NetworkPlayerInfo networkPlayerInfo = list.get(i); - String name = getPlayerName(networkPlayerInfo); + String name = getPlayerNameWithChecks(networkPlayerInfo); if (name == null) continue; @@ -341,7 +344,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, * @return the username of player */ @Nullable - private String getPlayerName(NetworkPlayerInfo networkPlayerInfo) { + private String getPlayerNameWithChecks(NetworkPlayerInfo networkPlayerInfo) { String name; if (networkPlayerInfo.getDisplayName() != null) { name = networkPlayerInfo.getDisplayName().getFormattedText(); @@ -356,7 +359,9 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, name = TextUtils.stripColor(name); - if(name.contains("(DEAD)")) return null; + if(name.contains("(DEAD)")) { + return null; + } name = name.replace(" ", "*"); -- cgit From 6d879cefdf5def3090cb45f82a52db077f1400e0 Mon Sep 17 00:00:00 2001 From: kingstefan26 Date: Tue, 4 Oct 2022 20:04:23 +0200 Subject: make sonarlint less mad (refactor) --- .../features/impl/dungeon/FeatureDungeonMap.java | 98 ++++++++++++---------- 1 file changed, 56 insertions(+), 42 deletions(-) (limited to 'src') 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("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")); + 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.getParameter("playerCenter").getValue() ? this.getParameter("postScale").getValue() : 1; + float postScale; + if (this.getParameter("playerCenter").getValue()) { + postScale = this.getParameter("postScale").getValue(); + } else { + postScale = 1; + } Rectangle featureRect = getFeatureRect().getRectangle(); int width = featureRect.width; - float scale = (this.getParameter("scale").getValue() ? width / 128.0f : 1); - GlStateManager.translate(width / 2, width / 2, 0); + float scale; + if (this.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.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.getParameter("playerCenter").getValue() && this.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.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(); -- cgit