use of net.minecraft.client.renderer.VertexBuffer in project Guide-API by TeamAmeriFrance.
the class SubTexture method draw.
@SideOnly(Side.CLIENT)
public void draw(int drawX, int drawY, double zLevel) {
final float someMagicValueFromMojang = 0.00390625F;
Minecraft.getMinecraft().renderEngine.bindTexture(textureLocation);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double) drawX, (double) (drawY + height), zLevel).tex((double) ((float) xPos * someMagicValueFromMojang), (double) ((float) (yPos + height) * someMagicValueFromMojang)).endVertex();
vertexbuffer.pos((double) (drawX + width), (double) (drawY + height), zLevel).tex((double) ((float) (xPos + width) * someMagicValueFromMojang), (double) ((float) (yPos + height) * someMagicValueFromMojang)).endVertex();
vertexbuffer.pos((double) (drawX + width), (double) drawY, zLevel).tex((double) ((float) (xPos + width) * someMagicValueFromMojang), (double) ((float) yPos * someMagicValueFromMojang)).endVertex();
vertexbuffer.pos((double) drawX, (double) drawY, zLevel).tex((double) ((float) xPos * someMagicValueFromMojang), (double) ((float) yPos * someMagicValueFromMojang)).endVertex();
tessellator.draw();
}
use of net.minecraft.client.renderer.VertexBuffer in project Witchworks by Um-Mitternacht.
the class BrewMod method render.
@SideOnly(Side.CLIENT)
private void render(int x, int y, float alpha) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceLocations.POTION_TEXTURES);
final Tessellator tessellator = Tessellator.getInstance();
final VertexBuffer buf = tessellator.getBuffer();
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
GlStateManager.color(1, 1, 1, alpha);
final int textureX = iconIndex % 8 * 18;
final int textureY = 198 + iconIndex / 8 * 18;
final float f = 0.00390625F;
buf.pos(x, y + 18, 0).tex(textureX * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y, 0).tex((textureX + 18) * f, textureY * f).endVertex();
buf.pos(x, y, 0).tex(textureX * f, textureY * f).endVertex();
tessellator.draw();
}
Aggregations