From bb507052d573c2754289a0de58de88fc72eade3a Mon Sep 17 00:00:00 2001 From: syeyoung <42869671+cyoung06@users.noreply.github.com> Date: Sat, 28 Nov 2020 15:37:36 +0900 Subject: puzzle solvers and bug fixes --- .../syeyoung/dungeonsguide/utils/RenderUtils.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index c985cf42..158793b3 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -93,6 +93,45 @@ public class RenderUtils { } + public static void drawLine(BlockPos pos1, BlockPos pos2, Color c, float partialTicks) { + + 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.pushAttrib(); + 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(); + + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glColor4ub((byte)c.getRed(), (byte)c.getGreen(), (byte)c.getBlue(), (byte)c.getAlpha()); + + GL11.glBegin(GL11.GL_LINES); + + GL11.glVertex3f(pos1.getX(), pos1.getY(), pos1.getZ()); + GL11.glVertex3f(pos1.getX(),pos1.getY(),pos1.getZ()); + + + GL11.glEnd(); + + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); + GlStateManager.popAttrib(); + } + public static void highlightBlock(BlockPos blockpos, Color c, float partialTicks) { Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity(); -- cgit