diff --git a/gradle.properties b/gradle.properties index 15eaf3a..b1c8060 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loomVersion = 0.6.37 minecraft16fabric = 1.16.5 mappings16fabric = 1.16.5+build.4 -mappings16forge = 20201028-1.16.3 +mappings16forge = 1.16.5 minecraft16forge = 1.16.5-36.0.46 minecraft8fabric = 1.8.9 diff --git a/panelstudio-mc16-forge/build.gradle b/panelstudio-mc16-forge/build.gradle index f3d6a42..6b298da 100644 --- a/panelstudio-mc16-forge/build.gradle +++ b/panelstudio-mc16-forge/build.gradle @@ -15,7 +15,7 @@ buildscript { apply plugin: "net.minecraftforge.gradle" minecraft { - mappings("snapshot",project.mappings16forge) + mappings("official",project.mappings16forge) } dependencies { diff --git a/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/GLInterface.java b/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/GLInterface.java index 197f1fb..651eb0b 100644 --- a/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/GLInterface.java +++ b/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/GLInterface.java @@ -58,10 +58,10 @@ public Dimension getWindowSize() { public void drawString(Point pos, int height, String s, Color c) { GL11.glPushMatrix(); GL11.glTranslatef(pos.x,pos.y,0); - double scale=height/(double)Minecraft.getInstance().fontRenderer.FONT_HEIGHT; + double scale=height/(double)Minecraft.getInstance().font.lineHeight; GL11.glScaled(scale,scale,1); end(false); - Minecraft.getInstance().fontRenderer.drawStringWithShadow(getMatrixStack(),s,0,0,c.getRGB()); + Minecraft.getInstance().font.drawShadow(getMatrixStack(),s,0,0,c.getRGB()); begin(false); GL11.glPopMatrix(); } @@ -69,53 +69,53 @@ public void drawString(Point pos, int height, String s, Color c) { @SuppressWarnings("resource") @Override public int getFontWidth(int height, String s) { - double scale=height/(double)Minecraft.getInstance().fontRenderer.FONT_HEIGHT; - return (int)Math.round(Minecraft.getInstance().fontRenderer.getStringWidth(s)*scale); + double scale=height/(double)Minecraft.getInstance().font.lineHeight; + return (int)Math.round(Minecraft.getInstance().font.width(s)*scale); } @Override public void fillTriangle(Point pos1, Point pos2, Point pos3, Color c1, Color c2, Color c3) { Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(GL11.GL_TRIANGLES,DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(pos1.x,pos1.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(pos2.x,pos2.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(pos3.x,pos3.y,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); - tessellator.draw(); + bufferbuilder.vertex(pos1.x,pos1.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(pos2.x,pos2.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(pos3.x,pos3.y,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); + tessellator.end(); } @Override public void drawLine(Point a, Point b, Color c1, Color c2) { Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(GL11.GL_LINES,DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(a.x,a.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(b.x,b.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); - tessellator.draw(); + bufferbuilder.vertex(a.x,a.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(b.x,b.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); + tessellator.end(); } @Override public void fillRect(Rectangle r, Color c1, Color c2, Color c3, Color c4) { Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(r.x,r.y+r.height,getZLevel()).color(c4.getRed()/255.0f,c4.getGreen()/255.0f,c4.getBlue()/255.0f,c4.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y+r.height,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x,r.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); - tessellator.draw(); + bufferbuilder.vertex(r.x,r.y+r.height,getZLevel()).color(c4.getRed()/255.0f,c4.getGreen()/255.0f,c4.getBlue()/255.0f,c4.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y+r.height,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x,r.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); + tessellator.end(); } @Override public void drawRect(Rectangle r, Color c1, Color c2, Color c3, Color c4) { Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(r.x,r.y+r.height,getZLevel()).color(c4.getRed()/255.0f,c4.getGreen()/255.0f,c4.getBlue()/255.0f,c4.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y+r.height,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); - bufferbuilder.pos(r.x,r.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); - tessellator.draw(); + bufferbuilder.vertex(r.x,r.y+r.height,getZLevel()).color(c4.getRed()/255.0f,c4.getGreen()/255.0f,c4.getBlue()/255.0f,c4.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y+r.height,getZLevel()).color(c3.getRed()/255.0f,c3.getGreen()/255.0f,c3.getBlue()/255.0f,c3.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y,getZLevel()).color(c2.getRed()/255.0f,c2.getGreen()/255.0f,c2.getBlue()/255.0f,c2.getAlpha()/255.0f).endVertex(); + bufferbuilder.vertex(r.x,r.y,getZLevel()).color(c1.getRed()/255.0f,c1.getGreen()/255.0f,c1.getBlue()/255.0f,c1.getAlpha()/255.0f).endVertex(); + tessellator.end(); } @Override @@ -123,7 +123,7 @@ public synchronized int loadImage(String name) { try { ResourceLocation rl=new ResourceLocation(getResourcePrefix()+name); if (!textures.contains(rl)) { - Minecraft.getInstance().getTextureManager().loadAsync(rl,null).get(); + Minecraft.getInstance().getTextureManager().preload(rl,null).get(); textures.add(rl); } return textures.indexOf(rl); @@ -165,18 +165,18 @@ public void drawImage(Rectangle r, int rotation, boolean parity, int image, Colo texCoords[1][1]=temp2; } Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); float[] colorBuffer={color.getRed()/255.0f,color.getGreen()/255.0f,color.getBlue()/255.0f,color.getAlpha()/255.0f}; - Minecraft.getInstance().getTextureManager().bindTexture(textures.get(image)); + Minecraft.getInstance().getTextureManager().bind(textures.get(image)); GL11.glTexEnvfv(GL11.GL_TEXTURE_ENV,GL11.GL_TEXTURE_ENV_COLOR,colorBuffer); - GlStateManager.enableTexture(); + GlStateManager._enableTexture(); bufferbuilder.begin(GL11.GL_QUADS,DefaultVertexFormats.POSITION_TEX); - bufferbuilder.pos(r.x,r.y+r.height,getZLevel()).tex(texCoords[0][0],texCoords[0][1]).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y+r.height,getZLevel()).tex(texCoords[1][0],texCoords[1][1]).endVertex(); - bufferbuilder.pos(r.x+r.width,r.y,getZLevel()).tex(texCoords[2][0],texCoords[2][1]).endVertex(); - bufferbuilder.pos(r.x,r.y,getZLevel()).tex(texCoords[3][0],texCoords[3][1]).endVertex(); - tessellator.draw(); - GlStateManager.disableTexture(); + bufferbuilder.vertex(r.x,r.y+r.height,getZLevel()).uv(texCoords[0][0],texCoords[0][1]).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y+r.height,getZLevel()).uv(texCoords[1][0],texCoords[1][1]).endVertex(); + bufferbuilder.vertex(r.x+r.width,r.y,getZLevel()).uv(texCoords[2][0],texCoords[2][1]).endVertex(); + bufferbuilder.vertex(r.x,r.y,getZLevel()).uv(texCoords[3][0],texCoords[3][1]).endVertex(); + tessellator.end(); + GlStateManager._disableTexture(); } /** @@ -192,7 +192,7 @@ protected void scissor (Rectangle r) { Point a=guiToScreen(r.getLocation()),b=guiToScreen(new Point(r.x+r.width,r.y+r.height)); if (!clipX) { a.x=0; - b.x=Minecraft.getInstance().getMainWindow().getWidth(); + b.x=Minecraft.getInstance().getWindow().getWidth(); } GL11.glScissor(Math.min(a.x,b.x),Math.min(a.y,b.y),Math.abs(b.x-a.x),Math.abs(b.y-a.y)); GL11.glEnable(GL11.GL_SCISSOR_TEST); @@ -243,7 +243,7 @@ public void restore() { public Point screenToGui (Point p) { int resX=getWindowSize().width; int resY=getWindowSize().height; - return new Point(p.x*resX/Minecraft.getInstance().getMainWindow().getWidth(),resY-p.y*resY/Minecraft.getInstance().getMainWindow().getHeight()-1); + return new Point(p.x*resX/Minecraft.getInstance().getWindow().getWidth(),resY-p.y*resY/Minecraft.getInstance().getWindow().getHeight()-1); } /** @@ -254,7 +254,7 @@ public Point screenToGui (Point p) { public Point guiToScreen (Point p) { double resX=getScreenWidth(); double resY=getScreenHeight(); - return new Point((int)Math.round(p.x*Minecraft.getInstance().getMainWindow().getWidth()/resX),(int)Math.round((resY-p.y)*Minecraft.getInstance().getMainWindow().getHeight()/resY)); + return new Point((int)Math.round(p.x*Minecraft.getInstance().getWindow().getWidth()/resX),(int)Math.round((resY-p.y)*Minecraft.getInstance().getWindow().getHeight()/resY)); } /** @@ -262,7 +262,7 @@ public Point guiToScreen (Point p) { * @return the screen width */ protected double getScreenWidth() { - return Minecraft.getInstance().getMainWindow().getScaledWidth(); + return Minecraft.getInstance().getWindow().getGuiScaledWidth(); } /** @@ -270,7 +270,7 @@ protected double getScreenWidth() { * @return the screen height */ protected double getScreenHeight() { - return Minecraft.getInstance().getMainWindow().getScaledHeight(); + return Minecraft.getInstance().getWindow().getGuiScaledHeight(); } /** @@ -288,11 +288,11 @@ public void begin (boolean matrix) { GL11.glPushMatrix(); GL11.glLoadIdentity(); } - GlStateManager.enableBlend(); - GlStateManager.disableTexture(); - GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA,GL11.GL_ONE,GL11.GL_ZERO); + GlStateManager._enableBlend(); + GlStateManager._disableTexture(); + GlStateManager._blendFuncSeparate(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA,GL11.GL_ONE,GL11.GL_ZERO); GL11.glShadeModel(GL11.GL_SMOOTH); - GlStateManager.lineWidth(2); + GlStateManager._lineWidth(2); // Set texture env mode to combine GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV,GL11.GL_TEXTURE_ENV_MODE,GL13.GL_COMBINE); @@ -319,8 +319,8 @@ public void begin (boolean matrix) { public void end (boolean matrix) { GL11.glPopAttrib(); GL11.glShadeModel(GL11.GL_FLAT); - GlStateManager.enableTexture(); - GlStateManager.disableBlend(); + GlStateManager._enableTexture(); + GlStateManager._disableBlend(); if (matrix) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); diff --git a/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/MinecraftGUI.java b/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/MinecraftGUI.java index a14823b..e8e90cd 100644 --- a/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/MinecraftGUI.java +++ b/panelstudio-mc16-forge/src/main/java/com/lukflug/panelstudio/mc16forge/MinecraftGUI.java @@ -47,14 +47,14 @@ public MinecraftGUI() { * Displays the GUI. */ public void enterGUI() { - Minecraft.getInstance().displayGuiScreen(this); + Minecraft.getInstance().setScreen(this); } /** * Closes the GUI. */ public void exitGUI() { - Minecraft.getInstance().displayGuiScreen(null); + Minecraft.getInstance().setScreen(null); } /**