aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2022-10-05 13:38:48 +0900
committerGitHub <noreply@github.com>2022-10-05 13:38:48 +0900
commit2ed36b677773543fbd7e2935e81e757017416bbe (patch)
tree818ae55e83e1d1eaddcc59f0607cc07701f3f86f /src
parent50de034c046c4ddea033b73793c8825ecb5bb86f (diff)
parent6d879cefdf5def3090cb45f82a52db077f1400e0 (diff)
downloadSkyblock-Dungeons-Guide-2ed36b677773543fbd7e2935e81e757017416bbe.tar.gz
Skyblock-Dungeons-Guide-2ed36b677773543fbd7e2935e81e757017416bbe.tar.bz2
Skyblock-Dungeons-Guide-2ed36b677773543fbd7e2935e81e757017416bbe.zip
Merge pull request #62 from kingstefan26/like-20-lines
fix dungeon map not showing ppl heads
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java18
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java276
2 files changed, 185 insertions, 109 deletions
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 e5d41de3..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
@@ -20,15 +20,17 @@ 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.*;
+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;
@@ -51,30 +53,34 @@ 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;
+import javax.vecmath.Vector2d;
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() {
- 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<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();
@@ -98,40 +104,39 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
}
@SideOnly(Side.CLIENT)
- static class PlayerComparator implements Comparator<NetworkPlayerInfo>
- {
- private PlayerComparator()
- {
+ static class PlayerComparator implements Comparator<NetworkPlayerInfo> {
+ 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();
}
}
+
@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.<AColor>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.<AColor>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.<AColor>getParameter("border_color").getValue());
+ RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue());
}
@Override
@@ -140,8 +145,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.<AColor>getParameter("background_color").getValue()));
+ Rectangle featureRect = getFeatureRect().getRectangle();
+ Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue()));
FontRenderer fr = getFontRenderer();
GlStateManager.enableBlend();
@@ -149,30 +154,41 @@ 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.<AColor>getParameter("border_color").getValue());
+ RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue());
}
- public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context){
- float postScale = this.<Boolean>getParameter("playerCenter").getValue() ? this.<Float>getParameter("postScale").getValue() : 1;
- Rectangle featureRect =getFeatureRect().getRectangle();
+ public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) {
+ 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);
+ 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.<Boolean>getParameter("playerCenter").getValue()) {
if (this.<Boolean>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);
+ render();
GlStateManager.enableBlend();
@@ -181,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);
}
@@ -191,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);
@@ -199,7 +215,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.<Float>getParameter("textScale").getValue();
- GlStateManager.scale(s,s,0);
+ GlStateManager.scale(s, s, 0);
String str = "";
str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets());
str += " ";
@@ -217,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();
}
@@ -226,7 +248,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();
@@ -267,38 +288,45 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
this.mapTexture.updateDynamicTexture();
}
+
private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) {
List<NetworkPlayerInfo> 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;
- String actual = TextUtils.stripColor(name).trim().split(" ")[0];
- EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(actual);
- if (TextUtils.stripColor(name).endsWith("(DEAD)") && entityplayer != Minecraft.getMinecraft().thePlayer) {
- continue;
- }
- Point pt2;
+
+ String name = getPlayerNameWithChecks(networkPlayerInfo);
+ if (name == null) continue;
+
+
+ EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name);
+
+ 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(actual);
+ String iconName = mapProcessor.getMapIconToPlayerMap().get(name);
if (iconName == null) continue;
Vec4b vec = mapData.mapDecorations.get(iconName);
if (vec == null) {
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 ;
+ pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64);
+ yaw2 = vec.func_176111_d() * 360 / 16.0f;
}
}
+
GlStateManager.pushMatrix();
- if (entityplayer == Minecraft.getMinecraft().thePlayer || this.<Boolean>getParameter("showotherplayers").getValue())
- {
+
+ boolean showOtherPlayers = this.<Boolean>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());
@@ -306,57 +334,99 @@ 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);
GlStateManager.scale(1 / postScale, 1 / postScale, 0);
+
float s = this.<Float>getParameter("playerheadscale").getValue();
- GlStateManager.scale(s,s,0);
- Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
+ GlStateManager.scale(s, s, 0);
+
+ // 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.<AColor>getParameter("player_color").getValue());
+ RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.<AColor>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 getPlayerNameWithChecks(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) {
+ private void renderArrows(MapData mapData, float scale, float postScale) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
int k = 0;
Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons);
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.scale(1 / scale, 1 / scale, 0);
- GlStateManager.scale(1 / postScale, 1 / postScale, 0);
- float s = this.<Float>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.<Boolean>getParameter("showotherplayers").getValue()) {
+ GlStateManager.pushMatrix();
+ 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);
+ float s = this.<Float>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 = (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);
+ 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;
+ }
}
}
- private void render(MapData mapData, boolean noOverlayRendering) {
+ private void render() {
int i = 0;
int j = 0;
Tessellator tessellator = Tessellator.getInstance();
@@ -367,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();