Search in sources :

Example 1 with IRenderTypeBuffer

use of net.minecraft.client.renderer.IRenderTypeBuffer in project AgriCraft by AgriCraft.

the class BotanyPotsPlantRenderer method renderPlant.

public void renderPlant(IAgriPlant plant, IAgriGrowthStage stage, IAgriWeed weed, IAgriGrowthStage weedStage, MatrixStack matrix, IRenderTypeBuffer buffer, int light, int overlay, Direction... preferredSides) {
    if (buffer instanceof IRenderTypeBuffer.Impl) {
        ITessellator tessellator = this.getTessellator((IRenderTypeBuffer.Impl) buffer);
        tessellator.pushMatrix();
        tessellator.setBrightness(light);
        tessellator.setOverlay(overlay);
        tessellator.applyTransformation(matrix.getLast().getMatrix());
        tessellator.startDrawingQuads();
        tessellator.addQuads(this.fetchQuads(plant, stage, preferredSides));
        tessellator.addQuads(this.fetchQuads(weed, weedStage, preferredSides));
        tessellator.draw();
        tessellator.popMatrix();
    }
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer)

Example 2 with IRenderTypeBuffer

use of net.minecraft.client.renderer.IRenderTypeBuffer in project AgriCraft by AgriCraft.

the class TileEntitySprinklerRenderer method render.

@Override
public void render(TileEntitySprinkler tile, float partialTicks, MatrixStack transforms, IRenderTypeBuffer buffer, int light, int overlay) {
    if (buffer instanceof IRenderTypeBuffer.Impl) {
        // Apply transformation
        transforms.push();
        transforms.translate(0.5, 0, 0.5);
        transforms.rotate(Vector3f.YP.rotationDegrees(tile.getAngle(partialTicks)));
        transforms.translate(-0.5, 0, -0.5);
        // Fetch tessellator and start drawing
        ITessellator tessellator = this.getTessellator((IRenderTypeBuffer.Impl) buffer);
        tessellator.startDrawingQuads();
        // Configure tessellator
        tessellator.pushMatrix();
        tessellator.applyTransformation(transforms.getLast().getMatrix());
        tessellator.setBrightness(light).setOverlay(overlay);
        // Draw
        this.drawGeometry(tessellator);
        // End drawing
        tessellator.popMatrix().draw();
        transforms.pop();
    }
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer)

Aggregations

ITessellator (com.infinityraider.infinitylib.render.tessellation.ITessellator)2 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)2