4747import net .minecraftforge .fml .client .GuiNotification ;
4848import net .minecraftforge .fml .common .eventhandler .SubscribeEvent ;
4949import net .minecraftforge .fml .common .gameevent .TickEvent ;
50+ import org .lwjgl .opengl .GL11 ;
5051
5152import java .awt .*;
5253import java .math .BigDecimal ;
@@ -72,6 +73,8 @@ public class RenderListener {
7273 private final static ResourceLocation SLASH_ICON = new ResourceLocation ("skyblockaddons" , "icons/slash.png" );
7374 private final static ResourceLocation IRON_GOLEM_ICON = new ResourceLocation ("skyblockaddons" , "icons/irongolem.png" );
7475
76+ private final static ResourceLocation DUNGEON_MAP = new ResourceLocation ("skyblockaddons" , "dungeonsmap.png" );
77+
7578 private final static ItemStack WATER_BUCKET = new ItemStack (Items .water_bucket );
7679 private final static ItemStack IRON_SWORD = new ItemStack (Items .iron_sword );
7780 private static ItemStack NETHER_STAR ;
@@ -1356,6 +1359,162 @@ private void drawDetailedPowerOrbStatus(Minecraft mc, float scale, ButtonLocatio
13561359 main .getUtils ().restoreGLOptions ();
13571360 }
13581361
1362+ float originalPlayerX = Integer .MIN_VALUE ;
1363+ float originalPlayerZ = -1 ;
1364+ float originalMapX = -1 ;
1365+ float originalMapZ = -1 ;
1366+
1367+ public void drawDungeonsMap (Minecraft mc , float scale , ButtonLocation buttonLocation ) {
1368+ ItemStack possibleMapItemStack = mc .thePlayer .inventory .getStackInSlot (8 );
1369+ if (buttonLocation == null && (possibleMapItemStack == null || possibleMapItemStack .getItem () != Items .filled_map ||
1370+ !possibleMapItemStack .hasDisplayName ())) {
1371+ return ;
1372+ }
1373+ boolean isScoreSummary = false ;
1374+ if (buttonLocation == null ) {
1375+ isScoreSummary = possibleMapItemStack .getDisplayName ().contains ("Your Score Summary" );
1376+
1377+ if (!possibleMapItemStack .getDisplayName ().contains ("Magical Map" ) && !isScoreSummary ) {
1378+ return ;
1379+ }
1380+ }
1381+
1382+ float x = main .getConfigValues ().getActualX (Feature .DUNGEONS_MAP_DISPLAY );
1383+ float y = main .getConfigValues ().getActualY (Feature .DUNGEONS_MAP_DISPLAY );
1384+
1385+ GlStateManager .pushMatrix ();
1386+
1387+ int originalSize = 128 ;
1388+ float initialScaleFactor = 0.5F ;
1389+
1390+ int size = (int ) (originalSize * initialScaleFactor );
1391+
1392+ int minecraftScale = new ScaledResolution (mc ).getScaleFactor ();
1393+ GL11 .glEnable (GL11 .GL_SCISSOR_TEST );
1394+ GL11 .glScissor (Math .round ((x - size * scale / 2F )*minecraftScale ),
1395+ mc .displayHeight -Math .round ((y + size * scale / 2F )*minecraftScale ), Math .round (size * minecraftScale * scale ), Math .round (size * minecraftScale * scale ));
1396+
1397+ x = transformXY (x , size , scale );
1398+ y = transformXY (y , size , scale );
1399+
1400+ if (buttonLocation != null ) {
1401+ buttonLocation .checkHoveredAndDrawBox (x , x +size , y , y +size , scale );
1402+ }
1403+
1404+ GL11 .glDisable (GL11 .GL_SCISSOR_TEST );
1405+ Color color = main .getConfigValues ().getColor (Feature .DUNGEONS_MAP_DISPLAY );
1406+ main .getUtils ().drawRect (x , y , x +size , y +size , 0x55000000 );
1407+ main .getUtils ().drawRectOutline (x , y , size , size , 1 , color .getRGB (), main .getConfigValues ().getChromaFeatures ().contains (Feature .DUNGEONS_MAP_DISPLAY ));
1408+ GlStateManager .color (1 ,1 ,1 ,1 );
1409+ GL11 .glEnable (GL11 .GL_SCISSOR_TEST );
1410+
1411+ main .getUtils ().enableStandardGLOptions ();
1412+
1413+ GlStateManager .color (1 ,1 ,1 ,1 );
1414+
1415+ float rotation = 180 - MathHelper .wrapAngleTo180_float (mc .thePlayer .rotationYaw );
1416+
1417+ float zoomScaleFactor = main .getUtils ().denormalizeScale (main .getConfigValues ().getMapZoom ().getValue (), 0.5F , 5 , 0.1F );
1418+ if (isScoreSummary ) {
1419+ zoomScaleFactor = 1 ;
1420+ }
1421+
1422+ float totalScaleFactor = initialScaleFactor * zoomScaleFactor ;
1423+
1424+ float mapSize = (originalSize * totalScaleFactor );
1425+
1426+ // float mapCenterX = x + size/2F;
1427+ // float mapCenterY = y + size/2F;
1428+
1429+ GlStateManager .scale (totalScaleFactor , totalScaleFactor , 1 );
1430+ x /= totalScaleFactor ;
1431+ y /= totalScaleFactor ;
1432+ GlStateManager .translate (x , y , 0 );
1433+
1434+ float rotationCenterX = originalSize * initialScaleFactor ;
1435+ float rotationCenterY = originalSize * initialScaleFactor ;
1436+
1437+ float centerOffset = -((mapSize -size )/zoomScaleFactor );
1438+ GlStateManager .translate (centerOffset , centerOffset , 0 );
1439+
1440+ boolean rotate = main .getConfigValues ().isEnabled (Feature .ROTATE_MAP );
1441+ boolean rotateOnPlayer = main .getConfigValues ().isEnabled (Feature .CENTER_ROTATION_ON_PLAYER );
1442+
1443+ if (isScoreSummary ) {
1444+ rotate = false ;
1445+ }
1446+
1447+ if (buttonLocation == null ) {
1448+ try {
1449+ MapData mapData = Items .filled_map .getMapData (possibleMapItemStack , mc .theWorld );
1450+
1451+ if (mapData != null ) {
1452+ if (mapData .mapDecorations != null ) {
1453+ for (Map .Entry <String , Vec4b > entry : mapData .mapDecorations .entrySet ()) {
1454+ if (entry .getValue ().func_176110_a () == 1 ) {
1455+ if (originalPlayerX == Integer .MIN_VALUE ) {
1456+ originalPlayerX = (float ) mc .thePlayer .posX ;
1457+ originalPlayerZ = (float ) mc .thePlayer .posZ ;
1458+ originalMapX = entry .getValue ().func_176112_b () / 2.0F + 64.0F ;
1459+ originalMapZ = entry .getValue ().func_176113_c () / 2.0F + 64.0F ;
1460+ }
1461+ }
1462+ }
1463+ }
1464+
1465+ float xMovement = (float ) mc .thePlayer .posX - originalPlayerX ;
1466+ float zMovement = (float ) mc .thePlayer .posZ - originalPlayerZ ;
1467+
1468+ float playerMarkerX = originalMapX + xMovement / 1.5F ;
1469+ float playerMarkerY = originalMapZ + zMovement / 1.5F ;
1470+
1471+ if (rotate && rotateOnPlayer && originalPlayerX != Integer .MIN_VALUE ) {
1472+ rotationCenterX = playerMarkerX ;
1473+ rotationCenterY = playerMarkerY ;
1474+ }
1475+
1476+ if (rotate ) {
1477+ if (rotateOnPlayer ) {
1478+ GlStateManager .translate (size - rotationCenterX , size - rotationCenterY , 0 );
1479+ }
1480+
1481+ GlStateManager .translate (rotationCenterX , rotationCenterY , 0 );
1482+ GlStateManager .rotate (rotation , 0 , 0 , 1 );
1483+ GlStateManager .translate (-rotationCenterX , -rotationCenterY , 0 );
1484+ }
1485+
1486+ MapItemRenderer .Instance instance = mc .entityRenderer .getMapItemRenderer ().getMapRendererInstance (mapData );
1487+ main .getUtils ().drawMapEdited (instance , playerMarkerX , playerMarkerY , 180 -rotation , !isScoreSummary );
1488+ } else {
1489+ originalPlayerX = Integer .MIN_VALUE ;
1490+ originalPlayerZ = -1 ;
1491+ originalMapX = -1 ;
1492+ originalMapZ = -1 ;
1493+ }
1494+ } catch (Exception ex ) {
1495+ ex .printStackTrace ();
1496+ }
1497+ } else {
1498+ if (rotate ) {
1499+ long ticks = System .currentTimeMillis () % 18000 / 50 ;
1500+
1501+ GlStateManager .translate (rotationCenterX , rotationCenterY , 0 );
1502+ GlStateManager .rotate (ticks , 0 , 0 , 1 );
1503+ GlStateManager .translate (-rotationCenterX , -rotationCenterY , 0 );
1504+ }
1505+
1506+ mc .getTextureManager ().bindTexture (DUNGEON_MAP );
1507+ main .getUtils ().drawModalRectWithCustomSizedTexture (0 , 0 , 0 , 0 , 128 ,128 , 128 , 128 );
1508+ }
1509+ // main.getUtils().drawRect(rotationCenterX-2, rotationCenterY-2, rotationCenterX+2, rotationCenterY+2, 0xFFFF0000);
1510+ GL11 .glDisable (GL11 .GL_SCISSOR_TEST );
1511+
1512+ GlStateManager .popMatrix ();
1513+ // main.getUtils().drawRect(mapCenterX-2, mapCenterY-2, mapCenterX+2, mapCenterY+2, 0xFF00FF00);
1514+
1515+ main .getUtils ().restoreGLOptions ();
1516+ }
1517+
13591518 /**
13601519 * Easily grab an attribute from utils.
13611520 */
0 commit comments