From 20dd3f99a7b139b5848128246c622fd9cfefa478 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 21 May 2022 21:18:14 +0900 Subject: - Project separation --- .../kr/syeyoung/dungeonsguide/utils/AhUtils.java | 87 -- .../syeyoung/dungeonsguide/utils/ArrayUtils.java | 40 - .../syeyoung/dungeonsguide/utils/GlStateUtils.java | 69 - .../kr/syeyoung/dungeonsguide/utils/MapUtils.java | 177 --- .../syeyoung/dungeonsguide/utils/RenderUtils.java | 1377 -------------------- .../syeyoung/dungeonsguide/utils/ShortUtils.java | 47 - .../dungeonsguide/utils/SkyblockUtils.java | 54 - .../kr/syeyoung/dungeonsguide/utils/TextUtils.java | 122 -- .../dungeonsguide/utils/TimeScoreUtil.java | 87 -- .../syeyoung/dungeonsguide/utils/VectorUtils.java | 53 - .../kr/syeyoung/dungeonsguide/utils/XPUtils.java | 222 ---- .../dungeonsguide/utils/cursor/CursorReader.java | 99 -- .../dungeonsguide/utils/cursor/EnumCursor.java | 54 - .../dungeonsguide/utils/cursor/Foundation.java | 34 - .../dungeonsguide/utils/cursor/GLCursors.java | 224 ---- .../dungeonsguide/utils/cursor/User32.java | 68 - .../syeyoung/dungeonsguide/utils/cursor/X11.java | 37 - 17 files changed, 2851 deletions(-) delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/GlStateUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/ShortUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/SkyblockUtils.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/CursorReader.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/EnumCursor.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/Foundation.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/GLCursors.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/User32.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/X11.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java deleted file mode 100644 index 049f8a0d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.utils; - -import java.security.*; -import java.security.cert.CertificateException; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.DungeonsGuide; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.util.Timer; -import java.util.TimerTask; - -public class AhUtils { - public static volatile Map auctions = new HashMap(); - - public static Timer timer = new Timer(); - - public static int totalAuctions = 0; - - public static void registerTimer() { - timer.schedule(new TimerTask() { - public void run() { - try { - AhUtils.loadAuctions(); - } catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | KeyStoreException | IllegalBlockSizeException | KeyManagementException e) { - e.printStackTrace(); - } - } - }, 0L, 1800000L); - } - - public static void loadAuctions() throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException, NoSuchPaddingException, BadPaddingException, KeyStoreException, IllegalBlockSizeException, KeyManagementException { - try { - - Map semi_auctions = new HashMap(); - JsonElement object = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJsonSecured("https://dungeons.guide/resource/keys"); - for (JsonElement element : object.getAsJsonArray()) { - JsonObject object1 = element.getAsJsonObject(); - AuctionData auctionData = new AuctionData(object1.get("id").getAsString()); - auctionData.lowestBin = object1.get("lowestBin").getAsInt(); - auctionData.sellPrice = object1.get("sellPrice").getAsInt(); - auctionData.buyPrice = object1.get("buyPrice").getAsInt(); - semi_auctions.put(auctionData.id, auctionData); - } - auctions = semi_auctions; - } catch (Throwable e) { - e.printStackTrace(); - } - } - - public static class AuctionData { - public String id; - - public long lowestBin = -1; - - public int sellPrice = -1; - - public int buyPrice = -1; - - public AuctionData(String id) { - this.id = id; - } - } -} \ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java deleted file mode 100755 index 8b84da13..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.utils; - -public class ArrayUtils { - public static int[][] rotateCounterClockwise(int[][] arr) { - int[][] res = new int[arr[0].length][arr.length]; - for(int y=0; y. - */ - -package kr.syeyoung.dungeonsguide.utils; - -import com.sun.org.apache.xpath.internal.operations.Bool; -import net.minecraft.client.renderer.GlStateManager; - -import java.lang.reflect.Field; -import java.util.*; - -public class GlStateUtils { - public static Map dumpStates() { - Map primitiveDump = new LinkedHashMap<>(); - try { - recursivelyDump(primitiveDump, "GlStateManager", null, GlStateManager.class); - } catch (IllegalAccessException e) { - e.printStackTrace(); - primitiveDump.put("$ERROR", true); - } - return primitiveDump; - } - - public static void printDump(Map dump) { - for (Map.Entry stringObjectEntry : dump.entrySet()) { - System.out.println(stringObjectEntry+": "+stringObjectEntry.getValue()); - } - } - - public static void compareDump(Map dump1, Map dump2) { - Set set = new HashSet<>(); - set.addAll(dump1.keySet()); - set.addAll(dump2.keySet()); - - for (String s : set) { - Object obj1 = dump1.get(s); - Object obj2 = dump2.get(s); - if (!Objects.equals(obj1, obj2)) System.out.println(s+": Prev {"+obj1+"} New {"+obj2+"}"); - } - } - - public static void recursivelyDump(Map primitiveDump, String objPath, Object obj, Class clazz) throws IllegalAccessException { - primitiveDump.put(objPath+".$class", clazz.getName()); - for (Field declaredField : clazz.getDeclaredFields()) { - declaredField.setAccessible(true); - Object fieldData = declaredField.get(obj); - if (fieldData.getClass().getName().startsWith("java.lang")) { - primitiveDump.put(objPath+"."+declaredField.getName(), fieldData); - } else { - recursivelyDump(primitiveDump, objPath+"."+declaredField.getName(), fieldData, fieldData.getClass()); - } - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java deleted file mode 100755 index 8fb90ec1..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.utils; - -import lombok.Getter; -import net.minecraft.block.material.MapColor; -import org.w3c.dom.css.Rect; - -import javax.vecmath.Vector2d; -import java.awt.*; -import java.awt.image.BufferedImage; - -public class MapUtils { - - private static Color[] colorMasks = new Color[128 * 128]; - @Getter - private static byte[] colors; - - public static void clearMap() { - colorMasks = new Color[128 * 128]; - colors = null; - } - - public static void record(byte[] colors, int x, int y, Color c) { - MapUtils.colors = colors; - colorMasks[y *128 +x] = c; - } - - public static byte getMapColorAt(byte[] colors, int x, int y) { - if (y <0 || y>= 128 || x < 0 || x >= 128) return 0; - return colors[y * 128 +x]; - } - - public static BufferedImage getImage() { - BufferedImage bufferedImage = new BufferedImage(128, 128,BufferedImage.TYPE_INT_ARGB); - if (colors == null) return bufferedImage; - Graphics graphics = bufferedImage.getGraphics(); - for (int y = 0; y < 128; y++) { - for (int x = 0; x <128; x++) { - bufferedImage.setRGB(x,y, getRGBColorAt(colors, x, y)); - if (colorMasks[y * 128 + x] != null) { - graphics.setColor(colorMasks[y *128 +x]); - graphics.drawLine(x,y,x,y); - } - } - } - return bufferedImage; - } - - public static int getRGBColorAt(byte[] colors, int x, int y) { - if (y <0 || y>= 128 || x < 0 || x >= 128) return 0; - int i = y * 128 +x; - int j = colors[i] & 255; - - int theColor; - if (j / 4 == 0) - { - theColor = (i + i / 128 & 1) * 8 + 16 << 24; - } - else - { - theColor = MapColor.mapColorArray[j / 4].getMapColor(j & 3); - } - - return theColor; - } - - public static Point findFirstColorWithIn(byte[] colors, byte color, Rectangle dimension) { - boolean found = true; - for (int y = dimension.y; y < (dimension.y + dimension.height);y++) { - for (int x = dimension.x; x < (dimension.x + dimension.width); x ++) { - if (getMapColorAt(colors, x ,y) == color && found) { - record(colors, x, y, new Color(255, 0, 0, 40)); - return new Point(x,y); - } - found = getMapColorAt(colors, x,y) == 0; - } - } - return null; - } - - public static Point findFirstColorWithInNegate(byte[] colors, byte color, Rectangle dimension) { - for (int y = dimension.y; y < (dimension.y + dimension.height);y++) { - for (int x = dimension.x; x < (dimension.x + dimension.width); x ++) { - if (getMapColorAt(colors, x ,y) != color) { - record(colors, x, y, new Color(255, 0, 0, 40)); - return new Point(x,y); - } - } - } - return null; - } - - public static int getWidthOfColorAt(byte[] colors, byte color, Point point) { - for (int x = point.x; x < 128; x++) { - record(colors, x, point.y, new Color(0, 255, 0, 40)); - if (getMapColorAt(colors, x, point.y) != color) return x - point.x; - } - return 128 - point.x; - } - public static int getHeightOfColorAt(byte[] colors, byte color, Point point) { - for (int y = point.y; y < 128; y++) { - record(colors, point.x, y, new Color(0, 255, 0, 40)); - if (getMapColorAt(colors, point.x,y) != color) return y - point.y; - } - return 128 - point.y; - } - - public static int getLengthOfColorExtending(byte[] colors, byte color, Point basePoint, Vector2d vector2d) { - for (int i = 0; i < 128; i++) { - int x = (int) (basePoint.x + vector2d.x * i); - int y = (int) (basePoint.y + vector2d.y * i); - record(colors, x, y, new Color(0, 0, 255, 40)); - if (getMapColorAt(colors, x,y) != color) return i; - } - return -1; - } - - - public static boolean matches(byte[] colors, byte[] stencil, int targetColor, int x, int y) { - for (int i = y; i < y + stencil.length; i++) { - for (int j = x; j < x + 8; j++) { - boolean current = getMapColorAt(colors, j, i) == targetColor; - boolean expected = ((stencil[i - y] >> (7-(j-x))) & 0x1) == 1; - if (current != expected) return false; - } - } - return true; - } - - public static int readDigit(byte[] colors, int x, int y) { - for (int i = 0; i < NUMBER_STENCIL.length; i++) { - if (matches(colors, NUMBER_STENCIL[i],34, x, y)) return i; - } - return -1; - } - public static int readNumber(byte[] colors, int x, int y, int gap) { - int number = 0; - for (int i = x; i < 128; i += gap) { - int digit = readDigit(colors, i, y); - if (digit != -1) number = number * 10 + digit; - } - return number; - } - - private static final byte[][] NUMBER_STENCIL = { - {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, - {0x0, 0x1E, 0x1E, 0x1E, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0x0}, - {0x0, 0x7F, 0x7F, 0x7F, 0x77, 0x77, 0x7, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x7F, 0x0}, - {0x0, 0x7F, 0x7F, 0x7F, 0x7, 0x7, 0x1F, 0x1F, 0x7, 0x7, 0x7F, 0x7F, 0x7F, 0x0}, - {0x0, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x7F, 0x7F, 0x7F, 0xE, 0xE, 0xE, 0x0}, - {0x0, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x7, 0x77, 0x77, 0x7F, 0x7F, 0x7F, 0x0}, - {0x0, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, - {0x0, 0x7F, 0x7F, 0x7F, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x0}, - {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x3E, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x0}, - {0x0, 0x7F, 0x7F, 0x77, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x7, 0x7F, 0x7F, 0x7F, 0x0} - }; - - - -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java deleted file mode 100755 index 18f09cb0..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ /dev/null @@ -1,1377 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.utils; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.util.*; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import javax.vecmath.Vector3f; -import java.awt.*; -import java.util.List; - -public class RenderUtils { - public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); - private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); - - /** - * Taken from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 - * And modified to fit out need. - * https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE - * @author Moulberry - */ - public static void renderBeaconBeam(double x, double y, double z, AColor aColor, float partialTicks) { - Entity player = Minecraft.getMinecraft().thePlayer; - double playerX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks; - double playerY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks; - double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; -//because of the way 3D rendering is done, all coordinates are relative to the camera. This "resets" the "0,0,0" position to the location that is (0,0,0) in the world. - - - GlStateManager.pushMatrix(); - GlStateManager.translate(-playerX, -playerY, -playerZ); - int height = 300; - int bottomOffset = 0; - int topOffset = bottomOffset + height; - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - - Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.enableTexture2D(); - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - - double time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + (double)partialTicks; - double d1 = MathHelper.func_181162_h(-time * 0.2D - (double)MathHelper.floor_double(-time * 0.1D)); - - int c = getColorAt(x,y,z, aColor); - float alpha = ((c >> 24) & 0xFF) / 255.0f; - - float r = ((c >> 16) & 0xFF) / 255f; - float g = ((c >> 8) & 0xFF) / 255f; - float b = (c & 0xFF) / 255f; - double d2 = time * 0.025D * -1.5D; - double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D; - double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D; - double d6 = 0.5D + Math.cos(d2 + (Math.PI / 4D)) * 0.2D; - double d7 = 0.5D + Math.sin(d2 + (Math.PI / 4D)) * 0.2D; - double d8 = 0.5D + Math.cos(d2 + 3.9269908169872414D) * 0.2D; - double d9 = 0.5D + Math.sin(d2 + 3.9269908169872414D) * 0.2D; - double d10 = 0.5D + Math.cos(d2 + 5.497787143782138D) * 0.2D; - double d11 = 0.5D + Math.sin(d2 + 5.497787143782138D) * 0.2D; - double d14 = -1.0D + d1; - double d15 = (double)(height) * 2.5D + d14; - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0D, d15).color(r, g, b, alpha).endVertex(); - worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0D, d15).color(r, g, b, alpha).endVertex(); - tessellator.draw(); - - double d12 = -1.0D + d1; - double d13 = height + d12; - - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alpha).endVertex(); - tessellator.draw(); - - GlStateManager.enableDepth(); - - GlStateManager.popMatrix(); - } - - - public static void drawTexturedRect(float x, float y, float width, float height, int filter) { - drawTexturedRect(x, y, width, height, 0.0F, 1.0F, 0.0F, 1.0F, filter); - } - private static float zLevel = 0; - public static int scrollY = 0; - public static boolean allowScrolling; - public static int scrollX = 0; - - public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) - { - float f = (float)(startColor >> 24 & 255) / 255.0F; - float f1 = (float)(startColor >> 16 & 255) / 255.0F; - float f2 = (float)(startColor >> 8 & 255) / 255.0F; - float f3 = (float)(startColor & 255) / 255.0F; - float f4 = (float)(endColor >> 24 & 255) / 255.0F; - float f5 = (float)(endColor >> 16 & 255) / 255.0F; - float f6 = (float)(endColor >> 8 & 255) / 255.0F; - float f7 = (float)(endColor & 255) / 255.0F; - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.shadeModel(7425); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)right, (double)top, (double)0).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)left, (double)top, (double)0).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)left, (double)bottom, (double)0).color(f5, f6, f7, f4).endVertex(); - worldrenderer.pos((double)right, (double)bottom, (double)0).color(f5, f6, f7, f4).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(7424); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - } - - public static void drawRect(int left, int top, int right, int bottom, AColor color) - { - if (left < right) - { - int i = left; - left = right; - right = i; - } - - if (top < bottom) - { - int j = top; - top = bottom; - bottom = j; - } - - float f3 = (float)(color.getRGB() >> 24 & 255) / 255.0F; - float f = (float)(color.getRGB() >> 16 & 255) / 255.0F; - float f1 = (float)(color.getRGB() >> 8 & 255) / 255.0F; - float f2 = (float)(color.getRGB() & 255) / 255.0F; - if (!color.isChroma() && f3 == 0) return; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - if (!color.isChroma()) { - GlStateManager.color(f, f1, f2, f3); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(left, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, top, 0.0D).endVertex(); - worldrenderer.pos(left, top, 0.0D).endVertex(); - } else { - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - color(worldrenderer.pos(left, bottom, 0.0D), getColorAt(left, bottom, color)).endVertex(); - color(worldrenderer.pos(right, bottom, 0.0D), getColorAt(right, bottom, color)).endVertex(); - color(worldrenderer.pos(right, top, 0.0D), getColorAt(right, top, color)).endVertex(); - color(worldrenderer.pos(left, top, 0.0D), getColorAt(left, top, color)).endVertex(); - } - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - - public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, double delta, int color) { - GlStateManager.pushMatrix(); - GlStateManager.translate(width/2.0+x, height/2.0+y, 0); - Tessellator t = Tessellator.getInstance(); - GlStateManager.disableTexture2D(); - RenderUtils.GL_SETCOLOR(color); - WorldRenderer wr = t.getWorldRenderer(); - wr.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION); - for (double i = 0.1; i < Math.PI*2; i+= delta) { - double cos = MathHelper.cos((float) i); - double sin = MathHelper.sin((float) i); - if (cos * MathHelper.cos((float) (i + delta)) <= 0) { - wr.pos(sin * radius + (sin > 0 ? 1 : -1) * (width/2.0 - radius), - cos * radius + (cos > 0 ? 1 : -1) * (height/2.0 - radius),0).endVertex(); - wr.pos(sin * radius + (sin > 0 ? 1 : -1) * (width/2.0 - radius), - cos * radius + (cos > 0 ? -1 : 1) * (height/2.0 - radius),0).endVertex(); - } else if (sin * MathHelper.sin((float) (i+delta)) <= 0) { - wr.pos(sin * radius + (sin > 0 ? 1 : -1) * (width/2.0 - radius), - cos * radius + (cos > 0 ? 1 : -1) * (height/2.0 - radius), 0).endVertex(); - wr.pos(sin * radius + (sin > 0 ? -1 : 1) * (width/2.0 - radius), - cos * radius + (cos > 0 ? 1 : -1) * (height/2.0 - radius), 0).endVertex(); - } else { - wr.pos(sin * radius + (sin > 0 ? 1 : -1) * (width/2.0 - radius), - cos * radius + (cos > 0 ? 1 : -1) * (height/2.0 - radius), 0).endVertex(); - } - } - t.draw(); - GlStateManager.popMatrix(); - } - - public static void GL_SETCOLOR(int color) { - float f3 = (float)(color >> 24 & 255) / 255.0F; - float f = (float)(color >> 16 & 255) / 255.0F; - float f1 = (float)(color >> 8 & 255) / 255.0F; - float f2 = (float)(color & 255) / 255.0F; - GlStateManager.color(f, f1, f2, f3); - } - - public static int blendTwoColors(int background, int newColor) { - float alpha = ((newColor >> 24) & 0xFF) /255.0f; - int r1 = (background >> 16) & 0xFF, r2 = (newColor >> 16) & 0xFF; - int g1 = (background >> 8) & 0xFF, g2 = (newColor >> 8) & 0xFF; - int b1 = (background) & 0xFF, b2 = (newColor) & 0xFF; - - int rr = (int) (r1 + (r2-r1) * alpha) & 0xFF; - int rg = (int) (g1 + (g2-g1) * alpha) & 0xFF; - int rb = (int) (b1 + (b2-b1) * alpha) & 0xFF; - return 0xFF000000 | ((rr << 16) & 0xFF0000) | ((rg << 8) & 0xFF00) | (rb & 0xFF); - } - - public static int blendAlpha(int origColor, float alphaPerc) { - return blendTwoColors(origColor, (int)(alphaPerc*255) << 24 | 0xFFFFFF); - } - - public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) { - GlStateManager.enableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 771); - GL11.glTexParameteri(3553, 10241, filter); - GL11.glTexParameteri(3553, 10240, filter); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(x, y + height, 0.0D).tex(uMin, vMax).endVertex(); - worldrenderer.pos(x + width, y + height, 0.0D).tex(uMax, vMax).endVertex(); - worldrenderer.pos(x + width, y, 0.0D).tex(uMax, vMin).endVertex(); - worldrenderer.pos(x, y, 0.0D).tex(uMin, vMin).endVertex(); - tessellator.draw(); - GL11.glTexParameteri(3553, 10241, 9728); - GL11.glTexParameteri(3553, 10240, 9728); - GlStateManager.disableBlend(); - } - public static void renderBar(float x, float y, float xSize, float completed) { - Minecraft.getMinecraft().getTextureManager().bindTexture(icons); - completed = (float)Math.round(completed / 0.05F) * 0.05F; - float notcompleted = 1.0F - completed; - int displayNum = 0; - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - float width = 0.0F; - if (completed < 0.5F && (displayNum == 1 || displayNum == 0)) { - width = (0.5F - completed) * xSize; - drawTexturedRect(x + xSize * completed, y, width, 5.0F, xSize * completed / 256.0F, xSize / 2.0F / 256.0F, 0.2890625F, 0.30859375F, 9728); - } - - if (completed < 1.0F && (displayNum == 2 || displayNum == 0)) { - width = Math.min(xSize * notcompleted, xSize / 2.0F); - drawTexturedRect(x + xSize / 2.0F + Math.max(xSize * (completed - 0.5F), 0.0F), y, width, 5.0F, (182.0F - xSize / 2.0F + Math.max(xSize * (completed - 0.5F), 0.0F)) / 256.0F, 0.7109375F, 0.2890625F, 0.30859375F, 9728); - } - - if (completed > 0.0F && (displayNum == 3 || displayNum == 0)) { - width = Math.min(xSize * completed, xSize / 2.0F); - drawTexturedRect(x, y, width, 5.0F, 0.0F, width / 256.0F, 0.30859375F, 0.328125F, 9728); - } - - if (completed > 0.5F && (displayNum == 4 || displayNum == 0)) { - width = Math.min(xSize * (completed - 0.5F), xSize / 2.0F); - drawTexturedRect(x + xSize / 2.0F, y, width, 5.0F, (182.0F - xSize / 2.0F) / 256.0F, (182.0F - xSize / 2.0F + width) / 256.0F, 0.30859375F, 0.328125F, 9728); - } - - } - - public static void drawUnfilledBox(int left, int top, int right, int bottom, int color, boolean chroma) - { - if (left < right) - { - int i = left; - left = right; - right = i; - } - - if (top < bottom) - { - int j = top; - top = bottom; - bottom = j; - } - - float f3 = (float)(color >> 24 & 255) / 255.0F; - float f = (float)(color >> 16 & 255) / 255.0F; - float f1 = (float)(color >> 8 & 255) / 255.0F; - float f2 = (float)(color & 255) / 255.0F; - if (!chroma && f3 == 0) return; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - if (!chroma) { - GlStateManager.color(f, f1, f2, f3); - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); - worldrenderer.pos(left, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, top, 0.0D).endVertex(); - worldrenderer.pos(left, top, 0.0D).endVertex(); - } else { - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR); - float blah = (System.currentTimeMillis() / 10) % 360; - GlStateManager.shadeModel(GL11.GL_SMOOTH); - color(worldrenderer.pos(left, bottom, 0.0D), Color.HSBtoRGB((((blah + 20) % 360) / 360.0f), 1, 1)).endVertex(); - color(worldrenderer.pos(right, bottom, 0.0D), Color.HSBtoRGB((((blah + 40) % 360) / 360.0f), 1, 1)).endVertex(); - color(worldrenderer.pos(right, top, 0.0D), Color.HSBtoRGB((((blah + 20) % 360) / 360.0f), 1, 1)).endVertex(); - color(worldrenderer.pos(left, top, 0.0D), Color.HSBtoRGB(blah / 360.0f, 1, 1)).endVertex(); - } - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - - public static void drawUnfilledBox(int left, int top, int right, int bottom, AColor color) - { - if (left < right) - { - int i = left; - left = right; - right = i; - } - - if (top < bottom) - { - int j = top; - top = bottom; - bottom = j; - } - - float f3 = (float)(color.getRGB() >> 24 & 255) / 255.0F; - float f = (float)(color.getRGB() >> 16 & 255) / 255.0F; - float f1 = (float)(color.getRGB() >> 8 & 255) / 255.0F; - float f2 = (float)(color.getRGB() & 255) / 255.0F; - if (!color.isChroma() && f3 == 0) return; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - if (!color.isChroma()) { - GlStateManager.color(f, f1, f2, f3); - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); - worldrenderer.pos(left, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, bottom, 0.0D).endVertex(); - worldrenderer.pos(right, top, 0.0D).endVertex(); - worldrenderer.pos(left, top, 0.0D).endVertex(); - } else { - worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - color(worldrenderer.pos(left, bottom, 0.0D), getColorAt(left, bottom, color)).endVertex(); - color(worldrenderer.pos(right, bottom, 0.0D), getColorAt(right, bottom, color)).endVertex(); - color(worldrenderer.pos(right, top, 0.0D), getColorAt(right, top, color)).endVertex(); - color(worldrenderer.pos(left, top, 0.0D), getColorAt(left, top, color)).endVertex(); - } - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - public static int getChromaColorAt(int x, int y, float speed, float s, float b, float alpha) { - double blah = ((double)(speed) * (System.currentTimeMillis() / 2)) % 360; - return (Color.HSBtoRGB((float) (((blah - (x + y) / 2.0f) % 360) / 360.0f), s,b) & 0xffffff) - | (((int)(alpha * 255)<< 24) & 0xff000000); - } - public static int getColorAt(double x, double y, AColor color) { - if (!color.isChroma()) - return color.getRGB(); - - double blah = ((double)(color.getChromaSpeed()) * (System.currentTimeMillis() / 2)) % 360; - float[] hsv = new float[3]; - Color.RGBtoHSB(color.getRed(), color.getBlue(), color.getGreen(), hsv); - - - return (Color.HSBtoRGB((float) (((blah - (x + y) / 2.0f) % 360) / 360.0f), hsv[1],hsv[2]) & 0xffffff) - | ((color.getAlpha() << 24) & 0xff000000); - } - public static int getColorAt(double x, double y,double z, AColor color) { - if (!color.isChroma()) - return color.getRGB(); - - double blah = ((double)(color.getChromaSpeed()) * (System.currentTimeMillis() / 2)) % 360; - float[] hsv = new float[3]; - Color.RGBtoHSB(color.getRed(), color.getBlue(), color.getGreen(), hsv); - - - return (Color.HSBtoRGB((float) (((blah - ((x + y+z) / 2.0f) % 360)) / 360.0f), hsv[1],hsv[2]) & 0xffffff) - | ((color.getAlpha() << 24) & 0xff000000); - } - - public static WorldRenderer color(WorldRenderer worldRenderer, int color ){ - return worldRenderer.color(((color >> 16) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f, (color &0xFF) / 255.0f, ((color >> 24) & 0xFF) / 255.0f); - } - - public static void renderDoor(DungeonDoor dungeonDoor, float partialTicks) { - Entity player = Minecraft.getMinecraft().thePlayer; - double playerX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks; - double playerY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks; - double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.translate(-playerX, -playerY, -playerZ); - GlStateManager.disableTexture2D(); - GlStateManager.enableAlpha(); - - if (dungeonDoor.getType().isExist()) - GlStateManager.color(0,1,0,1); - else - GlStateManager.color(1,0,0,1); - - double x = dungeonDoor.getPosition().getX() + 0.5; - double y = dungeonDoor.getPosition().getY() -0.99; - double z = dungeonDoor.getPosition().getZ() + 0.5; - GL11.glBegin(GL11.GL_QUADS); - - GL11.glVertex3d(x - 2.5, y, z - 2.5); - GL11.glVertex3d(x - 2.5, y, z + 2.5); - GL11.glVertex3d(x + 2.5, y, z + 2.5); - GL11.glVertex3d(x + 2.5, y, z - 2.5); - - GL11.glEnd(); - - if (dungeonDoor.getType().isExist()) { - GL11.glBegin(GL11.GL_QUADS); - - GlStateManager.color(0,0,1,1); - if (dungeonDoor.isZDir()) { - GL11.glVertex3d(x - 0.5, y + 0.1, z - 2.5); - GL11.glVertex3d(x - 0.5, y+ 0.1, z + 2.5); - GL11.glVertex3d(x + 0.5, y+ 0.1, z + 2.5); - GL11.glVertex3d(x + 0.5, y+ 0.1, z - 2.5); - } else { - GL11.glVertex3d(x - 2.5, y+ 0.1, z - 0.5); - GL11.glVertex3d(x - 2.5, y+ 0.1, z + 0.5); - GL11.glVertex3d(x + 2.5, y+ 0.1, z + 0.5); - GL11.glVertex3d(x + 2.5, y+ 0.1, z - 0.5); - } - - GL11.glEnd(); - } else { - GL11.glLineWidth(5); - GL11.glBegin(GL11.GL_LINE_LOOP); - GL11.glVertex3d(x - 2.5, y, z - 2.5); - GL11.glVertex3d(x + 2.5, y + 5, z - 2.5); - GL11.glVertex3d(x + 2.5, y, z + 2.5); - GL11.glVertex3d(x - 2.5, y + 5, z + 2.5); - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_LOOP); - GL11.glVertex3d(x - 2.5, y +5, z - 2.5); - GL11.glVertex3d(x + 2.5, y, z - 2.5); - GL11.glVertex3d(x + 2.5, y + 5, z + 2.5); - GL11.glVertex3d(x - 2.5, y, z + 2.5); - GL11.glEnd(); - GL11.glLineWidth(1); - } -// GlStateManager.disableAlpha(); - GlStateManager.disableBlend(); - - GlStateManager.enableTexture2D(); - - - RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - - GlStateManager.translate( dungeonDoor.getPosition().getX(), dungeonDoor.getPosition().getY(), dungeonDoor.getPosition().getZ()); - GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(renderManager.playerViewX, 1.0f, 0.0f, 0.0f); - - float lScale = 0.02f; - GlStateManager.scale(-lScale, -lScale, lScale); - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - String text = "Type: "+dungeonDoor.getType(); - int textWidth = fontRenderer.getStringWidth(text); - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - 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); - fontRenderer.drawString(text, -textWidth / 2, 0, 0xFF00FFFF); - - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.popMatrix(); - } - - public static void drawLine(Vec3 pos1, Vec3 pos2, Color colour, float partialTicks , boolean depth) { - Entity render = Minecraft.getMinecraft().getRenderViewEntity(); - WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); - - double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; - double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; - double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.translate(-realX, -realY, -realZ); - GlStateManager.disableTexture2D(); - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GL11.glLineWidth(2); - GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f); - worldRenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - - worldRenderer.pos(pos1.xCoord, pos1.yCoord, pos1.zCoord).endVertex(); - worldRenderer.pos(pos2.xCoord, pos2.yCoord, pos2.zCoord).endVertex(); - Tessellator.getInstance().draw(); - - GlStateManager.translate(realX, realY, realZ); - GlStateManager.disableBlend(); - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - - public static void drawLinesVec3(List poses, AColor colour, float thickness, float partialTicks, boolean depth) { - Entity render = Minecraft.getMinecraft().getRenderViewEntity(); - WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); - - double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; - double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; - double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.translate(-realX, -realY, -realZ); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GL11.glLineWidth(thickness); - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - -// GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f); - GlStateManager.color(1,1,1,1); - worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); - int num = 0; - for (Vec3 pos:poses) { - int i = getColorAt(num++ * 10,0, colour); - worldRenderer.pos(pos.xCoord, pos.yCoord, pos.zCoord).color( - ((i >> 16) &0xFF)/255.0f, - ((i >> 8) &0xFF)/255.0f, - (i &0xFF)/255.0f, - ((i >> 24) &0xFF)/255.0f - ).endVertex(); - } - Tessellator.getInstance().draw(); - - GlStateManager.translate(realX, realY, realZ); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - GL11.glLineWidth(1); - } - public static void drawLines(List poses, AColor colour, float thickness, float partialTicks, boolean depth) { - Entity render = Minecraft.getMinecraft().getRenderViewEntity(); - WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); - - double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; - double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; - double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.translate(-realX, -realY, -realZ); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GL11.glLineWidth(thickness); - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - -// GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f); - GlStateManager.color(1,1,1,1); - worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); - int num = 0; - for (BlockPos pos:poses) { - int i = getColorAt(num++ * 10,0, colour); - worldRenderer.pos(pos.getX() +0.5, pos.getY() +0.5, pos.getZ() +0.5).color( - ((i >> 16) &0xFF)/255.0f, - ((i >> 8) &0xFF)/255.0f, - (i &0xFF)/255.0f, - ((i >> 24) &0xFF)/255.0f - ).endVertex(); - } - Tessellator.getInstance().draw(); - - GlStateManager.translate(realX, realY, realZ); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - GL11.glLineWidth(1); - } - - public static void drawLines(List poses, Color colour, float thickness, float partialTicks, boolean depth) { - if (colour instanceof AColor) drawLines(poses, (AColor)colour, thickness, partialTicks,depth); - Entity render = Minecraft.getMinecraft().getRenderViewEntity(); - WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); - - double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; - double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; - double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; - - GlStateManager.pushMatrix(); - GlStateManager.translate(-realX, -realY, -realZ); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GL11.glLineWidth(thickness); - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - - GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f); - worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); - for (BlockPos pos:poses) { - worldRenderer.pos(pos.getX() +0.5, pos.getY() +0.5, pos.getZ() +0.5).endVertex(); - } - Tessellator.getInstance().draw(); - - GlStateManager.translate(realX, realY, realZ); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - - public static void highlightBlock(BlockPos blockpos, Color c, float partialTicks) { - highlightBlock(blockpos,c,partialTicks,false); - } - public static void highlightBlock(BlockPos blockpos, Color c, float partialTicks, boolean depth) { - Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity(); - - double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks); - double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks); - double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(-x_fix, -y_fix, -z_fix); - - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.disableTexture2D(); - - if (!depth) { - GlStateManager.disableDepth(); GL11.glDisable(GL11.GL_DEPTH_TEST); - GlStateManager.depthMask(false); - } - GlStateManager.color(c.getRed() /255.0f, c.getGreen() / 255.0f, c.getBlue()/ 255.0f, c.getAlpha()/ 255.0f); - - GlStateManager.translate(blockpos.getX(), blockpos.getY(), blockpos.getZ()); - - GL11.glBegin(GL11.GL_QUADS); - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, 0, 1); - GL11.glVertex3d(0, 1, 1); - GL11.glVertex3d(0, 1, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(1, 0, 1); - GL11.glVertex3d(1, 0, 0); - GL11.glVertex3d(1, 1, 0); - GL11.glVertex3d(1, 1, 1); - - GL11.glVertex3d(0, 1, 1); - GL11.glVertex3d(0, 0, 1); - GL11.glVertex3d(1, 0, 1); - GL11.glVertex3d(1, 1, 1); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, 1, 0); - GL11.glVertex3d(1, 1, 0); - GL11.glVertex3d(1, 0, 0); - - GL11.glVertex3d(0,1,0); - GL11.glVertex3d(0,1,1); - GL11.glVertex3d(1,1,1); - GL11.glVertex3d(1,1,0); - - GL11.glVertex3d(0,0,1); - GL11.glVertex3d(0,0,0); - GL11.glVertex3d(1,0,0); - GL11.glVertex3d(1,0,1); - - - - GL11.glEnd(); - - - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); - - - -//... - - } - - public static void highlightBox(AxisAlignedBB axisAlignedBB, Color c, float partialTicks, boolean depth) { - Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity(); - - double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks); - double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks); - double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(-x_fix, -y_fix, -z_fix); - - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.disableTexture2D(); - - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - int rgb = c.getRGB(); - GlStateManager.color(((rgb >> 16) &0XFF)/ 255.0f, ((rgb>>8) &0XFF)/ 255.0f, (rgb & 0xff)/ 255.0f, ((rgb >> 24) & 0xFF) / 255.0f); - - GlStateManager.translate(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); - - double x = axisAlignedBB.maxX - axisAlignedBB.minX; - double y = axisAlignedBB.maxY - axisAlignedBB.minY; - double z = axisAlignedBB.maxZ - axisAlignedBB.minZ; - GL11.glBegin(GL11.GL_QUADS); - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, 0, z); - GL11.glVertex3d(0, y, z); - GL11.glVertex3d(0, y, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(x, 0, z); - GL11.glVertex3d(x, 0, 0); - GL11.glVertex3d(x, y, 0); - GL11.glVertex3d(x, y, z); - - GL11.glVertex3d(0, y, z); - GL11.glVertex3d(0, 0, z); - GL11.glVertex3d(x, 0, z); - GL11.glVertex3d(x, y, z); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, y, 0); - GL11.glVertex3d(x, y, 0); - GL11.glVertex3d(x, 0, 0); - - GL11.glVertex3d(0,y,0); - GL11.glVertex3d(0,y,z); - GL11.glVertex3d(x,y,z); - GL11.glVertex3d(x,y,0); - - GL11.glVertex3d(0,0,z); - GL11.glVertex3d(0,0,0); - GL11.glVertex3d(x,0,0); - GL11.glVertex3d(x,0,z); - - - - GL11.glEnd(); - - - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); - - } - public static void highlightBoxAColor(AxisAlignedBB axisAlignedBB, AColor c, float partialTicks, boolean depth) { - Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity(); - - double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks); - double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks); - double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(-x_fix, -y_fix, -z_fix); - - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.disableTexture2D(); - - if (!depth) { - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - } - int rgb = RenderUtils.getColorAt(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ, c); - GlStateManager.color(((rgb >> 16) &0XFF)/ 255.0f, ((rgb>>8) &0XFF)/ 255.0f, (rgb & 0xff)/ 255.0f, ((rgb >> 24) & 0xFF) / 255.0f); - - GlStateManager.translate(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); - - double x = axisAlignedBB.maxX - axisAlignedBB.minX; - double y = axisAlignedBB.maxY - axisAlignedBB.minY; - double z = axisAlignedBB.maxZ - axisAlignedBB.minZ; - GL11.glBegin(GL11.GL_QUADS); - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, 0, z); - GL11.glVertex3d(0, y, z); - GL11.glVertex3d(0, y, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(x, 0, z); - GL11.glVertex3d(x, 0, 0); - GL11.glVertex3d(x, y, 0); - GL11.glVertex3d(x, y, z); - - GL11.glVertex3d(0, y, z); - GL11.glVertex3d(0, 0, z); - GL11.glVertex3d(x, 0, z); - GL11.glVertex3d(x, y, z); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT - - GL11.glVertex3d(0, 0, 0); - GL11.glVertex3d(0, y, 0); - GL11.glVertex3d(x, y, 0); - GL11.glVertex3d(x, 0, 0); - - GL11.glVertex3d(0,y,0); - GL11.glVertex3d(0,y,z); - GL11.glVertex3d(x,y,z); - GL11.glVertex3d(x,y,0); - - GL11.glVertex3d(0,0,z); - GL11.glVertex3d(0,0,0); - GL11.glVertex3d(x,0,0); - GL11.glVertex3d(x,0,z); - - - - GL11.glEnd(); - - - if (!depth) { - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - } - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); - - } - public static void highlightBox(Entity entity, AxisAlignedBB axisAlignedBB, AColor c, float partialTicks, boolean depth) { - Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity(); - - double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks); - double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks); - double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(-x_fix, -y_fix, -z_fix); - - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); -