Skip to content

Commit

Permalink
Switched to official mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukflug committed Apr 19, 2021
1 parent a4f8300 commit 1b455b9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion panelstudio-mc16-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
apply plugin: "net.minecraftforge.gradle"

minecraft {
mappings("snapshot",project.mappings16forge)
mappings("official",project.mappings16forge)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,72 +58,72 @@ 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();
}

@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
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);
Expand Down Expand Up @@ -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();
}

/**
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -254,23 +254,23 @@ 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));
}

/**
* Get the current screen width.
* @return the screen width
*/
protected double getScreenWidth() {
return Minecraft.getInstance().getMainWindow().getScaledWidth();
return Minecraft.getInstance().getWindow().getGuiScaledWidth();
}

/**
* Get the current screen height.
* @return the screen height
*/
protected double getScreenHeight() {
return Minecraft.getInstance().getMainWindow().getScaledHeight();
return Minecraft.getInstance().getWindow().getGuiScaledHeight();
}

/**
Expand All @@ -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);
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 1b455b9

Please sign in to comment.