Search in sources :

Example 16 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project Sprout by Toadstool-Studios.

the class GlowflyGlowingLayer method render.

@Override
public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, GlowflyEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
    if (entitylivingbaseIn.isInAir()) {
        GeoModelProvider<GlowflyEntity> provider = this.getEntityModel();
        GeoModel model = provider.getModel(provider.getModelLocation(entitylivingbaseIn));
        VertexConsumer buffer = bufferIn.getBuffer(RenderLayer.getEyes(new Identifier(MODID, "textures/entity/glowfly_glow.png")));
        getRenderer().render(model, entitylivingbaseIn, partialTicks, null, matrixStackIn, null, buffer, 15728640, OverlayTexture.DEFAULT_UV, 1F, 1F, 1F, 1F);
    }
}
Also used : Identifier(net.minecraft.util.Identifier) GlowflyEntity(com.toadstoolstudios.sprout.entities.GlowflyEntity) VertexConsumer(net.minecraft.client.render.VertexConsumer) GeoModel(software.bernie.geckolib3.geo.render.built.GeoModel)

Example 17 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project ThonkUtil by LimeAppleBoat.

the class ItemCapeRenderer method render.

@Override
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, AbstractClientPlayerEntity abstractClientPlayerEntity, float f, float g, float h, float j, float k, float l) {
    if (abstractClientPlayerEntity.canRenderCapeTexture() && !abstractClientPlayerEntity.isInvisible() && !ThonkUtilCapes.getCape(abstractClientPlayerEntity).equals(ItemStack.EMPTY) && ThonkUtilCapes.getCape(abstractClientPlayerEntity).getItem() instanceof CapeItem) {
        ItemStack itemStack = abstractClientPlayerEntity.getEquippedStack(EquipmentSlot.CHEST);
        if (!itemStack.isOf(Items.ELYTRA)) {
            matrixStack.push();
            matrixStack.translate(0.0D, 0.0D, 0.125D);
            double d = MathHelper.lerp((double) h, abstractClientPlayerEntity.prevCapeX, abstractClientPlayerEntity.capeX) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevX, abstractClientPlayerEntity.getX());
            double e = MathHelper.lerp((double) h, abstractClientPlayerEntity.prevCapeY, abstractClientPlayerEntity.capeY) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevY, abstractClientPlayerEntity.getY());
            double m = MathHelper.lerp((double) h, abstractClientPlayerEntity.prevCapeZ, abstractClientPlayerEntity.capeZ) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevZ, abstractClientPlayerEntity.getZ());
            float n = abstractClientPlayerEntity.prevBodyYaw + (abstractClientPlayerEntity.bodyYaw - abstractClientPlayerEntity.prevBodyYaw);
            double o = (double) MathHelper.sin(n * 0.017453292F);
            double p = (double) (-MathHelper.cos(n * 0.017453292F));
            float q = (float) e * 10.0F;
            q = MathHelper.clamp(q, -6.0F, 32.0F);
            float r = (float) (d * o + m * p) * 100.0F;
            r = MathHelper.clamp(r, 0.0F, 150.0F);
            float s = (float) (d * p - m * o) * 100.0F;
            s = MathHelper.clamp(s, -20.0F, 20.0F);
            if (r < 0.0F) {
                r = 0.0F;
            }
            float t = MathHelper.lerp(h, abstractClientPlayerEntity.prevStrideDistance, abstractClientPlayerEntity.strideDistance);
            q += MathHelper.sin(MathHelper.lerp(h, abstractClientPlayerEntity.prevHorizontalSpeed, abstractClientPlayerEntity.horizontalSpeed) * 6.0F) * 32.0F * t;
            if (abstractClientPlayerEntity.isInSneakingPose()) {
                q += 25.0F;
            }
            matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(6.0F + r / 2.0F + q));
            matrixStack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(s / 2.0F));
            matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180.0F - s / 2.0F));
            VertexConsumer enchantmentGlint = ItemRenderer.getItemGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityTranslucent(((CapeItem) ThonkUtilCapes.getCape(abstractClientPlayerEntity).getItem()).getCapeTexture()), false, ThonkUtilCapes.getCape(abstractClientPlayerEntity).hasGlint());
            VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntitySolid(((CapeItem) ThonkUtilCapes.getCape(abstractClientPlayerEntity).getItem()).getCapeTexture()));
            this.getContextModel().renderCape(matrixStack, enchantmentGlint, i, OverlayTexture.DEFAULT_UV);
            matrixStack.pop();
        }
    }
}
Also used : CapeItem(com.jab125.thonkutil.api.CapeItem) VertexConsumer(net.minecraft.client.render.VertexConsumer) ItemStack(net.minecraft.item.ItemStack)

Example 18 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project Biome-Makeover by Lemonszz.

the class AltarBlockEntityRenderer method render.

@Override
public void render(AltarBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
    matrices.push();
    matrices.translate(0.5D, 0.75D, 0.5D);
    float ticks = (float) entity.ticks + tickDelta;
    matrices.translate(0.0D, 0.1F + MathHelper.sin(ticks * 0.1F) * 0.01F, 0.0D);
    float h;
    for (h = entity.currentAngle - entity.lastAngle; h >= 3.1415927F; h -= 6.2831855F) {
    }
    while (h < -3.1415927F) {
        h += 6.2831855F;
    }
    float k = entity.lastAngle + h * tickDelta;
    matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(-k));
    matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(80.0F));
    float l = MathHelper.lerp(tickDelta, entity.pageAngle, entity.nextPageAngle);
    float m = MathHelper.fractionalPart(l + 0.25F) * 1.6F - 0.3F;
    float n = MathHelper.fractionalPart(l + 0.75F) * 1.6F - 0.3F;
    float o = MathHelper.lerp(tickDelta, entity.pageTurningSpeed, entity.nextPageTurningSpeed);
    this.book.setPageAngles(ticks, MathHelper.clamp(m, 0.0F, 1.0F), MathHelper.clamp(n, 0.0F, 1.0F), o);
    VertexConsumer vertexConsumer = BOOK_TEXTURE.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid);
    this.book.method_24184(matrices, vertexConsumer, light, overlay, 1.0F, 1.0F, 1.0F, 1.0F);
    matrices.pop();
}
Also used : RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 19 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project Biome-Makeover by Lemonszz.

the class TapestryBlockEntityRenderer method render.

public void render(TapestryBlockEntity tapestry, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
    float scale = 0.666F;
    boolean inInventory = tapestry.getWorld() == null;
    matrixStack.push();
    long time;
    if (inInventory) {
        time = 0L;
        matrixStack.translate(0.5D, 0.5D, 0.5D);
        this.pillar.visible = true;
    } else {
        time = tapestry.getWorld().getTime();
        BlockState blockState = tapestry.getCachedState();
        float rotation;
        if (blockState.getBlock() instanceof TapestryWallBlock || blockState.getBlock() instanceof AdjudicatorTapestryWallBlock) {
            matrixStack.translate(0.5D, -0.1666666716337204D, 0.5D);
            rotation = -blockState.get(TapestryWallBlock.FACING).asRotation();
            matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
            matrixStack.translate(0.0D, -0.3125D, -0.4375D);
            this.pillar.visible = false;
        } else {
            matrixStack.translate(0.5D, 0.5D, 0.5D);
            rotation = (float) (-(Integer) blockState.get(TapestryBlock.ROTATION) * 360) / 16.0F;
            matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
            this.pillar.visible = true;
        }
    }
    matrixStack.push();
    matrixStack.scale(scale, -scale, -scale);
    VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);
    this.pillar.render(matrixStack, vertexConsumer, i, j);
    this.crossbar.render(matrixStack, vertexConsumer, i, j);
    BlockPos blockPos = tapestry.getPos();
    float n = ((float) Math.floorMod((long) (blockPos.getX() * 7 + blockPos.getY() * 9 + blockPos.getZ() * 13) + time, 100L) + f) / 100.0F;
    this.banner.pitch = (-0.0125F + 0.01F * MathHelper.cos(6.2831855F * n)) * 3.1415927F;
    this.banner.pivotY = -32.0F;
    renderTapestry(matrixStack, vertexConsumerProvider, i, j, this.banner, tapestry.getColor());
    matrixStack.pop();
    matrixStack.pop();
}
Also used : BlockState(net.minecraft.block.BlockState) AdjudicatorTapestryWallBlock(party.lemons.biomemakeover.block.AdjudicatorTapestryWallBlock) AdjudicatorTapestryWallBlock(party.lemons.biomemakeover.block.AdjudicatorTapestryWallBlock) TapestryWallBlock(party.lemons.biomemakeover.block.TapestryWallBlock) RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer) BlockPos(net.minecraft.util.math.BlockPos)

Example 20 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project Biome-Makeover by Lemonszz.

the class LightningBugInnerFeatureRenderer method render.

public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, LightningBugEntity entity, float f, float g, float delta, float j, float k, float l) {
    if (!entity.isInvisible()) {
        this.getContextModel().copyStateTo(this.model);
        this.model.animateModel(entity, f, g, delta);
        this.model.setAngles(entity, f, g, j, k, l);
        VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(this.getTexture(entity)));
        Vector3f color = getColor(entity, delta);
        this.model.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(entity, 0.0F), color.getX(), color.getY(), color.getZ(), 1.0F);
    }
}
Also used : Vector3f(net.minecraft.client.util.math.Vector3f) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Aggregations

VertexConsumer (net.minecraft.client.render.VertexConsumer)44 Identifier (net.minecraft.util.Identifier)11 ItemStack (net.minecraft.item.ItemStack)8 RenderLayer (net.minecraft.client.render.RenderLayer)7 BlockState (net.minecraft.block.BlockState)5 Matrix4f (net.minecraft.util.math.Matrix4f)5 MatrixStack (net.minecraft.client.util.math.MatrixStack)4 Matrix3f (net.minecraft.util.math.Matrix3f)4 CapeItem (com.jab125.thonkutil.api.CapeItem)3 Quaternion (net.minecraft.util.math.Quaternion)3 Inject (org.spongepowered.asm.mixin.injection.Inject)3 MainMenu (com.tangykiwi.kiwiclient.gui.mainmenu.MainMenu)2 Cape (com.tangykiwi.kiwiclient.modules.other.Cape)2 ModelPart (net.minecraft.client.model.ModelPart)2 AbstractClientPlayerEntity (net.minecraft.client.network.AbstractClientPlayerEntity)2 Vector3f (net.minecraft.client.util.math.Vector3f)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 Vec3f (net.minecraft.util.math.Vec3f)2 Pair (com.mojang.datafixers.util.Pair)1 GlowflyEntity (com.toadstoolstudios.sprout.entities.GlowflyEntity)1