Search in sources :

Example 51 with VertexBuffer

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();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 52 with VertexBuffer

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();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

VertexBuffer (net.minecraft.client.renderer.VertexBuffer)52 Tessellator (net.minecraft.client.renderer.Tessellator)50 BlockPos (net.minecraft.util.math.BlockPos)8 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)5 EnumFacing (net.minecraft.util.EnumFacing)5 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)3 Minecraft (net.minecraft.client.Minecraft)3 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)3 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)3 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)3 Entity (net.minecraft.entity.Entity)3 Vec3i (net.minecraft.util.math.Vec3i)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 FontRenderer (net.minecraft.client.gui.FontRenderer)2 RenderManager (net.minecraft.client.renderer.entity.RenderManager)2 Vec3d (net.minecraft.util.math.Vec3d)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 NotNull (org.jetbrains.annotations.NotNull)2 IImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable)1