mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Updated FML Gui methods to WorldRenderer API changes.
This commit is contained in:
1 parent
13c7d038eb
commit
426340fed5
3 files changed
+67
-78
No files matched your search
@@ -37,6 +37,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
@@ -529,13 +530,13 @@ public class GuiModList extends GuiScreen
|
||||
{
|
||||
GlStateManager.enableBlend();
|
||||
GuiModList.this.mc.renderEngine.bindTexture(logoPath);
|
||||
WorldRenderer world = tess.getWorldRenderer();
|
||||
WorldRenderer wr = tess.getWorldRenderer();
|
||||
int offset = (this.left + this.listWidth/2) - (logoDims.width / 2);
|
||||
world.startDrawingQuads();
|
||||
world.addVertexWithUV(offset, top + logoDims.height, zLevel, 0, 1);
|
||||
world.addVertexWithUV(offset + logoDims.width, top + logoDims.height, zLevel, 1, 1);
|
||||
world.addVertexWithUV(offset + logoDims.width, top, zLevel, 1, 0);
|
||||
world.addVertexWithUV(offset, top, zLevel, 0, 0);
|
||||
wr.func_181668_a(7, DefaultVertexFormats.field_181707_g);
|
||||
wr.func_181662_b(offset, top + logoDims.height, zLevel).func_181673_a(0, 1).func_181675_d();
|
||||
wr.func_181662_b(offset + logoDims.width, top + logoDims.height, zLevel).func_181673_a(1, 1).func_181675_d();
|
||||
wr.func_181662_b(offset + logoDims.width, top, zLevel).func_181673_a(1, 0).func_181675_d();
|
||||
wr.func_181662_b(offset, top, zLevel).func_181673_a(0, 0).func_181675_d();
|
||||
tess.draw();
|
||||
GlStateManager.disableBlend();
|
||||
top += logoDims.height + 10;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -262,12 +263,11 @@ public abstract class GuiScrollingList
|
||||
this.client.renderEngine.bindTexture(Gui.optionsBackground);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float scale = 32.0F;
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorOpaque_I(2105376);
|
||||
worldr.addVertexWithUV(this.left, this.bottom, 0.0D, this.left / scale, (this.bottom + (int)this.scrollDistance) / scale);
|
||||
worldr.addVertexWithUV(this.right, this.bottom, 0.0D, this.right / scale, (this.bottom + (int)this.scrollDistance) / scale);
|
||||
worldr.addVertexWithUV(this.right, this.top, 0.0D, this.right / scale, (this.top + (int)this.scrollDistance) / scale);
|
||||
worldr.addVertexWithUV(this.left, this.top, 0.0D, this.left / scale, (this.top + (int)this.scrollDistance) / scale);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(this.left, this.bottom, 0.0D).func_181673_a(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.bottom, 0.0D).func_181673_a(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.top, 0.0D).func_181673_a(this.right / scale, (this.top + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.left, this.top, 0.0D).func_181673_a(this.left / scale, (this.top + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@@ -290,17 +290,15 @@ public abstract class GuiScrollingList
|
||||
int max = entryRight;
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableTexture2D();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorOpaque_I(0x808080);
|
||||
worldr.addVertexWithUV(min, slotTop + slotBuffer + 2, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(max, slotTop + slotBuffer + 2, 0.0D, 1.0D, 1.0D);
|
||||
worldr.addVertexWithUV(max, slotTop - 2, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(min, slotTop - 2, 0.0D, 0.0D, 0.0D);
|
||||
worldr.setColorOpaque_I(0);
|
||||
worldr.addVertexWithUV(min + 1, slotTop + slotBuffer + 1, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(max - 1, slotTop + slotBuffer + 1, 0.0D, 1.0D, 1.0D);
|
||||
worldr.addVertexWithUV(max - 1, slotTop - 1, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(min + 1, slotTop - 1, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(min, slotTop + slotBuffer + 2, 0).func_181673_a(0, 1).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(max, slotTop + slotBuffer + 2, 0).func_181673_a(1, 1).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(max, slotTop - 2, 0).func_181673_a(1, 0).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(min, slotTop - 2, 0).func_181673_a(0, 0).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(min + 1, slotTop + slotBuffer + 1, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(max - 1, slotTop + slotBuffer + 1, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(max - 1, slotTop - 1, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(min + 1, slotTop - 1, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
@@ -322,21 +320,17 @@ public abstract class GuiScrollingList
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.disableTexture2D();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0, 0);
|
||||
worldr.addVertexWithUV(this.left, this.top + border, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(this.right, this.top + border, 0.0D, 1.0D, 1.0D);
|
||||
worldr.setColorRGBA_I(0, 255);
|
||||
worldr.addVertexWithUV(this.right, this.top, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(this.left, this.top, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(this.left, this.top + border, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.top + border, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.top, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.left, this.top, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0, 255);
|
||||
worldr.addVertexWithUV(this.left, this.bottom, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(this.right, this.bottom, 0.0D, 1.0D, 1.0D);
|
||||
worldr.setColorRGBA_I(0, 0);
|
||||
worldr.addVertexWithUV(this.right, this.bottom - border, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(this.left, this.bottom - border, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(this.left, this.bottom, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.bottom, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(this.right, this.bottom - border, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d();
|
||||
worldr.func_181662_b(this.left, this.bottom - border, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d();
|
||||
tess.draw();
|
||||
|
||||
int extraHeight = this.getContentHeight() - viewHeight - border;
|
||||
@@ -355,26 +349,23 @@ public abstract class GuiScrollingList
|
||||
barTop = this.top;
|
||||
}
|
||||
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0, 255);
|
||||
worldr.addVertexWithUV(scrollBarLeft, this.bottom, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight, this.bottom, 0.0D, 1.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight, this.top, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(scrollBarLeft, this.top, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(scrollBarLeft, this.bottom, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight, this.bottom, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight, this.top, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarLeft, this.top, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0x808080, 255);
|
||||
worldr.addVertexWithUV(scrollBarLeft, barTop + height, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight, barTop + height, 0.0D, 1.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight, barTop, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(scrollBarLeft, barTop, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(scrollBarLeft, barTop + height, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight, barTop + height, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight, barTop, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarLeft, barTop, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0xC0C0C0, 255);
|
||||
worldr.addVertexWithUV(scrollBarLeft, barTop + height - 1, 0.0D, 0.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight - 1, barTop + height - 1, 0.0D, 1.0D, 1.0D);
|
||||
worldr.addVertexWithUV(scrollBarRight - 1, barTop, 0.0D, 1.0D, 0.0D);
|
||||
worldr.addVertexWithUV(scrollBarLeft, barTop, 0.0D, 0.0D, 0.0D);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(scrollBarLeft, barTop + height - 1, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight - 1, barTop + height - 1, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarRight - 1, barTop, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d();
|
||||
worldr.func_181662_b(scrollBarLeft, barTop, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d();
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@@ -385,7 +376,7 @@ public abstract class GuiScrollingList
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
private void overlayBackground(int top, int height, int alpha1, int alpah2)
|
||||
private void overlayBackground(int top, int height, int alpha1, int alpha2)
|
||||
{
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
WorldRenderer worldr = tess.getWorldRenderer();
|
||||
@@ -393,13 +384,11 @@ public abstract class GuiScrollingList
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float scale = 32.0F;
|
||||
double startUV = (screenWidth / scale) / screenWidth * (left-0);
|
||||
worldr.startDrawingQuads();
|
||||
worldr.setColorRGBA_I(0x404040, alpah2);
|
||||
worldr.addVertexWithUV(left, height, 0.0D, startUV, height / scale);
|
||||
worldr.addVertexWithUV(left+listWidth+8, height, 0.0D, (left+listWidth+8) / scale, height / scale);
|
||||
worldr.setColorRGBA_I(0x404040, alpha1);
|
||||
worldr.addVertexWithUV(left+listWidth+8, top, 0.0D, (left+listWidth+8) / scale, top / scale);
|
||||
worldr.addVertexWithUV(left, top, 0.0D, startUV, top / scale);
|
||||
worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i);
|
||||
worldr.func_181662_b(left, height, 0.0D).func_181673_a(startUV, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d();
|
||||
worldr.func_181662_b(left+listWidth+8, height, 0.0D).func_181673_a((left+listWidth+8) / scale, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d();
|
||||
worldr.func_181662_b(left+listWidth+8, top, 0.0D).func_181673_a((left+listWidth+8) / scale, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d();
|
||||
worldr.func_181662_b(left, top, 0.0D).func_181673_a(startUV, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d();
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@@ -420,13 +409,11 @@ public abstract class GuiScrollingList
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
worldrenderer.startDrawingQuads();
|
||||
worldrenderer.setColorRGBA_F(r1, g1, b1, a1);
|
||||
worldrenderer.addVertex(right, top, 0.0D);
|
||||
worldrenderer.addVertex(left, top, 0.0D);
|
||||
worldrenderer.setColorRGBA_F(r2, g2, b2, a2);
|
||||
worldrenderer.addVertex(left, bottom, 0.0D);
|
||||
worldrenderer.addVertex(right, bottom, 0.0D);
|
||||
worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181706_f);
|
||||
worldrenderer.func_181662_b(right, top, 0.0D).func_181666_a(r1, g1, b1, a1).func_181675_d();
|
||||
worldrenderer.func_181662_b(left, top, 0.0D).func_181666_a(r1, g1, b1, a1).func_181675_d();
|
||||
worldrenderer.func_181662_b(left, bottom, 0.0D).func_181666_a(r2, g2, b2, a2).func_181675_d();
|
||||
worldrenderer.func_181662_b(right, bottom, 0.0D).func_181666_a(r2, g2, b2, a2).func_181675_d();
|
||||
tessellator.draw();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -181,15 +182,15 @@ public class GuiUtils
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
float var7 = 0.00390625F;
|
||||
float var8 = 0.00390625F;
|
||||
float uScale = 1f / 0x100;
|
||||
float vScale = 1f / 0x100;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldr = tessellator.getWorldRenderer();
|
||||
worldr.startDrawingQuads();
|
||||
worldr.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
|
||||
worldr.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
|
||||
worldr.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
|
||||
worldr.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
wr.func_181668_a(7, DefaultVertexFormats.field_181707_g);
|
||||
wr.func_181662_b(x , y + height, zLevel).func_181673_a( u * uScale, ((v + height) * vScale)).func_181675_d();
|
||||
wr.func_181662_b(x + width, y + height, zLevel).func_181673_a((u + width) * uScale, ((v + height) * vScale)).func_181675_d();
|
||||
wr.func_181662_b(x + width, y , zLevel).func_181673_a((u + width) * uScale, ( v * vScale)).func_181675_d();
|
||||
wr.func_181662_b(x , y , zLevel).func_181673_a( u * uScale, ( v * vScale)).func_181675_d();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user