use of net.minecraft.client.renderer.Tessellator in project Railcraft by Railcraft.
the class FluidModelRenderer method renderFluid.
/**
* @param level Ranges from 1 to 16 inclusively, 0 will crash
*/
public void renderFluid(FluidStack fluidStack, int level) {
IBakedModel bakedModel = new FluidModel(fluidStack, false).bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, RenderTools::getTexture);
Minecraft mc = Minecraft.getMinecraft();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
Tessellator tess = Tessellator.getInstance();
VertexBuffer buffer = tess.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
IExtendedBlockState state = (IExtendedBlockState) new ExtendedBlockState(Blocks.WATER, new IProperty[] { BlockFluidBase.LEVEL }, BlockFluidBase.FLUID_RENDER_PROPS.toArray(new IUnlistedProperty<?>[0])).getBaseState();
for (int i = 0; i < 4; i++) state = state.withProperty(BlockFluidBase.LEVEL_CORNERS[i], level / 16F);
state = (IExtendedBlockState) state.withProperty(BlockFluidBase.LEVEL, level - 1);
state = state.withProperty(BlockFluidBase.FLOW_DIRECTION, -1000F);
putQuads(buffer, bakedModel.getQuads(state, null, 1234));
for (EnumFacing side : EnumFacing.VALUES) {
putQuads(buffer, bakedModel.getQuads(state, side, 1234));
}
tess.draw();
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
use of net.minecraft.client.renderer.Tessellator in project Railcraft by Railcraft.
the class JSONModelRenderer method renderModel.
public void renderModel(ResourceLocation model) {
IBakedModel bakedModel = bakedModels.get(model);
if (bakedModel == null)
return;
Minecraft mc = Minecraft.getMinecraft();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
Tessellator tess = Tessellator.getInstance();
VertexBuffer buffer = tess.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
putQuads(buffer, bakedModel.getQuads(null, null, 1234));
for (EnumFacing side : EnumFacing.VALUES) {
putQuads(buffer, bakedModel.getQuads(null, side, 1234));
}
tess.draw();
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class GuiGraphics method drawSlotBackground.
public static void drawSlotBackground(Minecraft mc, int x, int y, int color) {
GuiGraphics.zLevel = 0;
GL11.glColor4f(Color.getRed(color), Color.getGreen(color), Color.getBlue(color), Color.getAlpha(color));
mc.renderEngine.bindTexture(GuiGraphics.SLOT_TEXTURE);
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.addVertexWithUV(x, y + 18, GuiGraphics.zLevel, 0, 1);
var9.addVertexWithUV(x + 18, y + 18, GuiGraphics.zLevel, 1, 1);
var9.addVertexWithUV(x + 18, y, GuiGraphics.zLevel, 1, 0);
var9.addVertexWithUV(x, y, GuiGraphics.zLevel, 0, 0);
var9.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.
the class RenderShrapnel method renderArrow.
public void renderArrow(EntityFragments suiPian, double par2, double par4, double par6, float par8, float par9) {
if (suiPian.isAnvil) {
GL11.glPushMatrix();
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
RenderUtility.setTerrainTexture();
Block block = Blocks.anvil;
World world = suiPian.worldObj;
GL11.glDisable(GL11.GL_LIGHTING);
RenderUtility.renderBlocks.blockAccess = world;
Tessellator var12 = Tessellator.instance;
var12.startDrawingQuads();
var12.setTranslation((-MathHelper.floor_double(suiPian.posX)) - 0.5F, (-MathHelper.floor_double(suiPian.posY)) - 0.5F, (-MathHelper.floor_double(suiPian.posZ)) - 0.5F);
RenderUtility.renderBlocks.renderBlockByRenderType(block, MathHelper.floor_double(suiPian.posX), MathHelper.floor_double(suiPian.posY), MathHelper.floor_double(suiPian.posZ));
var12.setTranslation(0.0D, 0.0D, 0.0D);
var12.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
} else {
this.bindTexture(TEXTURE_FILE);
GL11.glPushMatrix();
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glRotatef(suiPian.prevRotationYaw + (suiPian.rotationYaw - suiPian.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(suiPian.prevRotationPitch + (suiPian.rotationPitch - suiPian.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator var10 = Tessellator.instance;
byte var11 = 0;
float var12 = 0.0F;
float var13 = 0.5F;
float var14 = (0 + var11 * 10) / 32.0F;
float var15 = (5 + var11 * 10) / 32.0F;
float var16 = 0.0F;
float var17 = 0.15625F;
float var18 = (5 + var11 * 10) / 32.0F;
float var19 = (10 + var11 * 10) / 32.0F;
float var20 = 0.05625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float var21 = suiPian.arrowShake - par9;
if (var21 > 0.0F) {
float var22 = -MathHelper.sin(var21 * 3.0F) * var21;
GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F);
}
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(var20, var20, var20);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, var17, var19);
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, var16, var19);
var10.draw();
GL11.glNormal3f(-var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, var16, var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, var17, var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var19);
var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var19);
var10.draw();
for (int var23 = 0; var23 < 4; ++var23) {
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, var20);
var10.startDrawingQuads();
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, var12, var14);
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, var13, var14);
var10.addVertexWithUV(8.0D, 2.0D, 0.0D, var13, var15);
var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, var12, var15);
var10.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
use of net.minecraft.client.renderer.Tessellator in project ICBM-Classic by BuiltBrokenModding.
the class RenderExplosion method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float par8, float par9) {
EntityExplosion entityExplosion = (EntityExplosion) entity;
if (entityExplosion.getBlast() != null) {
// RedM atter Render
if (entityExplosion.getBlast() instanceof BlastRedmatter) {
Tessellator tessellator = Tessellator.instance;
/** Draw Sphere */
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + entityExplosion.yOffset, (float) z);
RenderUtility.enableBlending();
RenderUtility.disableLighting();
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.9f);
bindTexture(SharedAssets.GREY_TEXTURE);
Sphere sphere = new Sphere();
float radius = Math.max((BlastRedmatter.ENTITY_DESTROY_RADIUS * (entityExplosion.getBlast().getRadius() / BlastRedmatter.NORMAL_RADIUS)), 6);
sphere.draw(radius, 32, 32);
// Enable Lighting/Glow Off
RenderUtility.enableLighting();
// Disable Blending
RenderUtility.disableBlending();
GL11.glPopMatrix();
/** Draw Vortex
*
* GL11.glPushMatrix(); GL11.glDepthMask(false);
*
* CalclaviaRenderHelper.enableBlending(); CalclaviaRenderHelper.disableLighting();
*
* GL11.glTranslated(x, y, z); GL11.glRotatef(-entity.ticksExisted, 0, 1, 0);
*
* float size = 10; float f10 = 1.0F;
*
* int textureSize = 50; float size4 = size * 5; float float_sizeMinus0_01 =
* textureSize - 0.01F;
*
* float x0 = (textureSize + 0.0F) / size4; float x1 = (textureSize +
* float_sizeMinus0_01) / size4; float x2 = (textureSize + 0.0F) / size4; float x3 =
* (textureSize + float_sizeMinus0_01) / size4;
*
* float renderX = (float) x; float renderY = (float) y; float renderZ = (float) z;
*
* this.bindTexture(TEXTURE_FILE); tessellator.startDrawingQuads();
* tessellator.setBrightness(240); tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
* tessellator.addVertexWithUV(-size, 0, -size, x1, x3);
* tessellator.addVertexWithUV(-size, 0, +size, x1, x2);
* tessellator.addVertexWithUV(+size, 0, +size, x0, x2);
* tessellator.addVertexWithUV(+size, 0, -size, x0, x3); tessellator.draw();
*
* // Enable Lighting/Glow Off CalclaviaRenderHelper.enableLighting();
*
* // Disable Blending CalclaviaRenderHelper.disableBlending();
*
* GL11.glDepthMask(true); GL11.glPopMatrix(); */
/** Enderdragon Light */
float par2 = (entity.ticksExisted);
while (par2 > 200) par2 -= 100;
RenderHelper.disableStandardItemLighting();
float var41 = (5 + par2) / 200.0F;
float var51 = 0.0F;
if (var41 > 0.8F) {
var51 = (var41 - 0.8F) / 0.2F;
}
Random rand = new Random(432L);
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(false);
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, -1.0F, -2.0F);
for (int i1 = 0; i1 < (var41 + var41 * var41) / 2.0F * 60.0F; ++i1) {
GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rand.nextFloat() * 360.0F + var41 * 90.0F, 0.0F, 0.0F, 1.0F);
tessellator.startDrawing(6);
float var81 = rand.nextFloat() * 20.0F + 5.0F + var51 * 10.0F;
float var91 = rand.nextFloat() * 2.0F + 1.0F + var51 * 2.0F;
tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - var51)));
tessellator.addVertex(0.0D, 0.0D, 0.0D);
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertex(-0.866D * var91, var81, -0.5F * var91);
tessellator.addVertex(0.866D * var91, var81, -0.5F * var91);
tessellator.addVertex(0.0D, var81, 1.0F * var91);
tessellator.addVertex(-0.866D * var91, var81, -0.5F * var91);
tessellator.draw();
}
GL11.glPopMatrix();
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
} else {
if (entityExplosion.getBlast().getRenderModel() != null && entityExplosion.getBlast().getRenderResource() != null) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + 1F, (float) z);
GL11.glRotatef(entityExplosion.rotationPitch, 0.0F, 0.0F, 1.0F);
this.bindTexture(entityExplosion.getBlast().getRenderResource());
entityExplosion.getBlast().getRenderModel().render(entityExplosion, (float) x, (float) y, (float) z, par8, par9, 0.0625F);
GL11.glPopMatrix();
}
}
}
}
Aggregations