use of net.minecraft.client.renderer.BufferBuilder in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class ModelHelper method renderBakedModel.
public static void renderBakedModel(IBakedModel bakedModel) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
for (BakedQuad bakedQuad : bakedModel.getQuads(null, null, 1)) worldrenderer.addVertexData(bakedQuad.getVertexData());
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project RFTools by McJty.
the class RenderWorldLastEventHandler method renderBuilderProgress.
private static void renderBuilderProgress(RenderWorldLastEvent evt) {
Map<BlockPos, Pair<Long, BlockPos>> scans = BuilderTileEntity.getScanLocClient();
if (!scans.isEmpty()) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP p = mc.player;
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();
GlStateManager.pushMatrix();
GlStateManager.color(1.0f, 0, 0);
GlStateManager.glLineWidth(3);
GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
for (Map.Entry<BlockPos, Pair<Long, BlockPos>> entry : scans.entrySet()) {
BlockPos c = entry.getValue().getValue();
float mx = c.getX();
float my = c.getY();
float mz = c.getZ();
mcjty.lib.gui.RenderHelper.renderHighLightedBlocksOutline(buffer, mx, my, mz, 0.0f, 1.0f, 1.0f, 1.0f);
}
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project Immersive-Tech by FerroO2000.
the class TileRenderSteamTurbine method render.
@Override
public void render(TileEntitySteamTurbine te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (!te.formed || te.isDummy() || !te.getWorld().isBlockLoaded(te.getPos(), false)) {
return;
}
final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos blockPos = te.getPos();
IBlockState state = getWorld().getBlockState(blockPos);
if (state.getBlock() != ITContent.blockMetalMultiblock) {
return;
}
state = state.getBlock().getActualState(state, getWorld(), blockPos);
state = state.withProperty(IEProperties.DYNAMICRENDER, true);
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldRenderer = tessellator.getBuffer();
ClientUtils.bindAtlas();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.translate(.5, .5, .5);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(770, 771);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(7425);
} else {
GlStateManager.shadeModel(7424);
}
GlStateManager.rotate(te.getAnimation().getAnimationRotation() + (te.getAnimation().getAnimationStep() * partialTicks), te.facing.getFrontOffsetX(), 0, te.facing.getFrontOffsetZ());
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
worldRenderer.setTranslation(-.5 - blockPos.getX(), -.5 - blockPos.getY(), -.5 - blockPos.getZ());
worldRenderer.color(255, 255, 255, 255);
blockRenderer.getBlockModelRenderer().renderModel(te.getWorld(), model, state, blockPos, worldRenderer, true);
worldRenderer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class RenderFakeBlocks method drawFakeBlock.
public static void drawFakeBlock(TextureAtlasSprite texture, double minX, double minY, double minZ) {
if (texture == null)
return;
double maxX = minX + 1;
double maxY = minY + 1;
double maxZ = minZ + 1;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder wr = tessellator.getBuffer();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
float texMinU = texture.getMinU();
float texMinV = texture.getMinV();
float texMaxU = texture.getMaxU();
float texMaxV = texture.getMaxV();
wr.pos(minX, minY, minZ).tex(texMinU, texMinV).endVertex();
wr.pos(maxX, minY, minZ).tex(texMaxU, texMinV).endVertex();
wr.pos(maxX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(minX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
wr.pos(minX, maxY, maxZ).tex(texMinU, texMaxV).endVertex();
wr.pos(maxX, maxY, maxZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(maxX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
wr.pos(minX, maxY, minZ).tex(texMinU, texMinV).endVertex();
wr.pos(maxX, minY, minZ).tex(texMinU, texMaxV).endVertex();
wr.pos(minX, minY, minZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(minX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
wr.pos(maxX, maxY, minZ).tex(texMinU, texMinV).endVertex();
wr.pos(minX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
wr.pos(maxX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(maxX, maxY, maxZ).tex(texMaxU, texMinV).endVertex();
wr.pos(minX, maxY, maxZ).tex(texMinU, texMinV).endVertex();
wr.pos(minX, minY, minZ).tex(texMinU, texMaxV).endVertex();
wr.pos(minX, minY, maxZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(minX, maxY, maxZ).tex(texMaxU, texMinV).endVertex();
wr.pos(minX, maxY, minZ).tex(texMinU, texMinV).endVertex();
wr.pos(maxX, minY, maxZ).tex(texMinU, texMaxV).endVertex();
wr.pos(maxX, minY, minZ).tex(texMaxU, texMaxV).endVertex();
wr.pos(maxX, maxY, minZ).tex(texMaxU, texMinV).endVertex();
wr.pos(maxX, maxY, maxZ).tex(texMinU, texMinV).endVertex();
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class RenderItemRoutingNode method render.
@Override
public void render(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (mc.player.getHeldItemMainhand().getItem() instanceof INodeRenderer || ConfigHandler.client.alwaysRenderRoutingLines) {
List<BlockPos> connectionList = tileNode.getConnected();
for (BlockPos wantedPos : connectionList) {
BlockPos offsetPos = wantedPos.subtract(tileNode.getPos());
// The beam renders towards the east by default.
int xd = offsetPos.getX();
int yd = offsetPos.getY();
int zd = offsetPos.getZ();
double distance = Math.sqrt(xd * xd + yd * yd + zd * zd);
double subLength = MathHelper.sqrt(xd * xd + zd * zd);
float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI));
float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI));
GlStateManager.pushMatrix();
float f1 = 1.0f;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder wr = tessellator.getBuffer();
this.bindTexture(beamTexture);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GlStateManager.disableLighting();
GlStateManager.disableCull();
float f2 = 0;
float f3 = -f2 * 0.2F - (float) MathHelper.floor(-f2 * 0.1F);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
double width = 0.06;
float test = (tileNode.getWorld().getTotalWorldTime() + partialTicks) / 5f;
double d18 = -width / 2;
double d19 = -width / 2;
double d20 = width / 2;
double d21 = -width / 2;
double d22 = -width / 2;
double d23 = width / 2;
double d24 = width / 2;
double d25 = width / 2;
double d26 = distance * f1;
double d27 = 0.0D;
double d28 = 1.0D;
double d29 = (double) (f3) + test;
double d30 = distance * f1 + d29;
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
GlStateManager.rotate(rotYaw, 0, 1, 0);
GlStateManager.rotate(rotPitch, 0, 0, 1);
// tessellator.setBrightness(240);
// float s = 1F / 16F;
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
// tessellator.setColorRGBA(255, 255, 255, 100);
wr.pos(d26, d18, d19).tex(d28, d30).endVertex();
wr.pos(0, d18, d19).tex(d28, d29).endVertex();
wr.pos(0, d20, d21).tex(d27, d29).endVertex();
wr.pos(d26, d20, d21).tex(d27, d30).endVertex();
wr.pos(d26, d24, d25).tex(d28, d30).endVertex();
wr.pos(0, d24, d25).tex(d28, d29).endVertex();
wr.pos(0, d22, d23).tex(d27, d29).endVertex();
wr.pos(d26, d22, d23).tex(d27, d30).endVertex();
wr.pos(d26, d20, d21).tex(d28, d30).endVertex();
wr.pos(0, d20, d21).tex(d28, d29).endVertex();
wr.pos(0, d24, d25).tex(d27, d29).endVertex();
wr.pos(d26, d24, d25).tex(d27, d30).endVertex();
wr.pos(d26, d22, d23).tex(d28, d30).endVertex();
wr.pos(0, d22, d23).tex(d28, d29).endVertex();
wr.pos(0, d18, d19).tex(d27, d29).endVertex();
wr.pos(d26, d18, d19).tex(d27, d30).endVertex();
ShaderHelper.useShader(ShaderHelper.psiBar, (int) tileNode.getWorld().getTotalWorldTime());
tessellator.draw();
ShaderHelper.releaseShader();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
}
}
Aggregations