use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class TelePadSpecialRenderer method render.
public void render(@Nonnull TileEntity tileEntity, @Nonnull final IBlockState state) {
final BlockPos pos = tileEntity.getPos();
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder vertexBuffer = tessellator.getBuffer();
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
final IBakedModel ibakedmodel = blockrendererdispatcher.getBlockModelShapes().getModelForState(state);
vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
vertexBuffer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
blockrendererdispatcher.getBlockModelRenderer().renderModel(tileEntity.getWorld(), ibakedmodel, state, pos, vertexBuffer, false);
vertexBuffer.setTranslation(0, 0, 0);
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class SoulBinderTESR method renderBlockModel.
@SuppressWarnings("null")
public static void renderBlockModel(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean translateToOrigin, boolean relight) {
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
if (translateToOrigin) {
wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
}
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel ibakedmodel = modelShapes.getModelForState(state);
final IBlockAccess worldWrapper = relight ? new WorldWrapper(world, pos) : world;
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(worldWrapper, ibakedmodel, state, pos, wr, false);
}
}
ForgeHooksClient.setRenderLayer(null);
if (translateToOrigin) {
wr.setTranslation(0, 0, 0);
}
Tessellator.getInstance().draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class TravelEntitySpecialRenderer method renderBlock.
public void renderBlock(@Nonnull BlockPos pos, IBlockAccess blockAccess, double globalScale, boolean highlight) {
BufferBuilder tes = Tessellator.getInstance().getBuffer();
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate(0.5f, 0.5f, 0.5f);
GlStateManager.scale(globalScale, globalScale, globalScale);
GlStateManager.translate(-0.5f, -0.5f, -0.5f);
IBlockState state = blockAccess.getBlockState(pos).getActualState(blockAccess, pos);
IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, blockAccess, pos);
tes.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
Vector4f color = highlight ? selectedBlockBlend : blockBlend;
GlStateManager.color(1, 1, 1, 1);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_COLOR, GlStateManager.SourceFactor.ONE.factor, GlStateManager.DestFactor.ZERO.factor);
GL14.glBlendColor(color.x, color.y, color.z, color.w);
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (state.getBlock().canRenderInLayer(state, NullHelper.notnullJ(layer, "BlockRenderLayer value was null!"))) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, tes, false);
}
}
ForgeHooksClient.setRenderLayer(null);
Tessellator.getInstance().draw();
GL14.glBlendColor(1, 1, 1, 1);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
tes.setTranslation(0, 0, 0);
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class ReservoirRenderer method renderTankFluid.
private void renderTankFluid(SmartTank tank, Set<EnumFacing> mergers, World world, BlockPos pos) {
final FluidStack fluid = tank.getFluid();
if (fluid != null) {
TextureAtlasSprite icon = RenderUtil.getStillTexture(fluid);
int color = fluid.getFluid().getColor(fluid);
float fullness = tank.getFilledRatio();
boolean[][][] merge = getMergers9(world, pos);
BufferBuilder tes = Tessellator.getInstance().getBuffer();
float minU = icon.getMinU(), maxU = icon.getMaxU(), minV = icon.getMinV(), maxV = icon.getMaxV();
for (int i = 0; i <= 1; i++) {
if (i == 0) {
GlStateManager.cullFace(CullFace.FRONT);
} else {
GlStateManager.cullFace(CullFace.BACK);
}
for (NNIterator<EnumFacing> facings = NNList.FACING.fastIterator(); facings.hasNext(); ) {
EnumFacing dir = facings.next();
float fullness2 = 0;
if (mergers.contains(dir)) {
BlockPos pos2 = pos.offset(dir);
TileEntity tileEntity = world.getTileEntity(pos2);
if (tileEntity instanceof TileReservoir) {
TileReservoir res2 = (TileReservoir) tileEntity;
fullness2 = res2.tank.getFilledRatio();
}
}
BoundingBox bb = mkFace(merge, dir, fullness, fullness2);
if (bb != null) {
float minVx = minV, maxVx = maxV;
if (dir.getAxis() != EnumFacing.Axis.Y) {
minVx = icon.getInterpolatedV((1 - fullness) * 16);
maxVx = icon.getInterpolatedV((1 - fullness2) * 16);
}
renderFace(tes, bb, dir, minU, maxU, minVx, maxVx, color);
}
}
}
}
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class ObeliskSpecialRenderer method renderObelisk.
protected void renderObelisk() {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
RenderUtil.bindBlockTexture();
BufferBuilder tes = Tessellator.getInstance().getBuffer();
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
for (BakedQuad quad : bakedQuads) {
tes.addVertexData(quad.getVertexData());
}
Tessellator.getInstance().draw();
GlStateManager.disableRescaleNormal();
}
Aggregations