use of com.wynntils.modules.map.instances.LootRunPath in project Wynntils by Wynntils.
the class LootRunPage method postEntries.
@Override
public void postEntries(int mouseX, int mouseY, float partialTicks) {
int x = width / 2;
int y = height / 2;
int posX = (x - mouseX);
int posY = (y - mouseY);
int mapX = x - 154;
int mapY = y + 23;
int mapWidth = 145;
int mapHeight = 58;
if (LootRunManager.getActivePathName() != null) {
// render info
ScreenRenderer.scale(1.2f);
render.drawString(LootRunManager.getActivePathName(), x / 1.2f - 154 / 1.2f, y / 1.2f - 35 / 1.2f, CommonColors.BLACK, SmartFontRenderer.TextAlignment.LEFT_RIGHT, SmartFontRenderer.TextShadow.NONE);
ScreenRenderer.resetScale();
LootRunPath path = LootRunManager.getActivePath();
Location start = path.getPoints().get(0);
render.drawString("Chests: " + path.getChests().size(), x - 154, y - 20, CommonColors.BLACK, SmartFontRenderer.TextAlignment.LEFT_RIGHT, SmartFontRenderer.TextShadow.NONE);
render.drawString("Notes: " + path.getNotes().size(), x - 154, y - 10, CommonColors.BLACK, SmartFontRenderer.TextAlignment.LEFT_RIGHT, SmartFontRenderer.TextShadow.NONE);
render.drawString("Start point: " + start, x - 154, y, CommonColors.BLACK, SmartFontRenderer.TextAlignment.LEFT_RIGHT, SmartFontRenderer.TextShadow.NONE);
render.drawString("End point: " + path.getLastPoint(), x - 154, y + 10, CommonColors.BLACK, SmartFontRenderer.TextAlignment.LEFT_RIGHT, SmartFontRenderer.TextShadow.NONE);
// render map of starting point
MapProfile map = MapModule.getModule().getMainMap();
if (map != null) {
// <--- min texture x point
float minX = map.getTextureXPosition(start.x) - mapScale * (mapWidth / 2f);
// <--- min texture z point
float minZ = map.getTextureZPosition(start.z) - mapScale * (mapHeight / 2f);
// <--- max texture x point
float maxX = map.getTextureXPosition(start.x) + mapScale * (mapWidth / 2f);
// <--- max texture z point
float maxZ = map.getTextureZPosition(start.z) + mapScale * (mapHeight / 2f);
minX /= (float) map.getImageWidth();
maxX /= (float) map.getImageWidth();
minZ /= (float) map.getImageHeight();
maxZ /= (float) map.getImageHeight();
try {
enableAlpha();
enableTexture2D();
// boundary around map
int boundarySize = 3;
render.drawRect(Textures.Map.paper_map_textures, mapX - boundarySize, mapY - boundarySize, mapX + mapWidth + boundarySize, mapY + mapHeight + boundarySize, 0, 0, 217, 217);
ScreenRenderer.enableScissorTest(mapX, mapY, mapWidth, mapHeight);
map.bindTexture();
color(1.0f, 1.0f, 1.0f, 1.0f);
glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
enableBlend();
enableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
{
bufferbuilder.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_TEX);
bufferbuilder.pos(mapX, mapY + mapHeight, 0).tex(minX, maxZ).endVertex();
bufferbuilder.pos(mapX + mapWidth, mapY + mapHeight, 0).tex(maxX, maxZ).endVertex();
bufferbuilder.pos(mapX + mapWidth, mapY, 0).tex(maxX, minZ).endVertex();
bufferbuilder.pos(mapX, mapY, 0).tex(minX, minZ).endVertex();
tessellator.draw();
}
// render the line on the map
if (MapConfig.LootRun.INSTANCE.displayLootrunOnMap) {
List<MapIcon> icons = LootRunManager.getMapPathWaypoints();
for (MapIcon mapIcon : icons) {
mapIcon.renderAt(render, (float) (mapX + mapWidth / 2f + (mapIcon.getPosX() - start.getX()) / (float) mapScale), (float) (mapY + mapHeight / 2f + (mapIcon.getPosZ() - start.getZ()) / (float) mapScale), 1 / ((float) mapScale + 1 / 4f) + 0.2f, 1 / (float) mapScale);
}
}
mapHovered = posX <= 154 && posX >= 154 - mapWidth && posY <= -23 && posY >= -23 - mapHeight;
if (mapHovered) {
hoveredText = Arrays.asList(TextFormatting.YELLOW + "Click to open Map!", TextFormatting.WHITE + "Scroll to change map size!");
}
} catch (Exception ignored) {
}
// reset settings
disableAlpha();
disableBlend();
ScreenRenderer.disableScissorTest();
ScreenRenderer.clearMask();
}
} else {
drawTextLines(textLines, x - 154, y - 30, 1);
}
// buttons
drawMenuButton(x, y, posX, posY);
}
Aggregations