Search in sources :

Example 6 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project wildmod by Osmiooo.

the class MangroveBoatEntityRenderer method render.

public void render(MangroveBoatEntity boatEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    matrixStack.push();
    matrixStack.translate(0.0D, 0.375D, 0.0D);
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180.0F - f));
    float h = (float) boatEntity.getDamageWobbleTicks() - g;
    float j = boatEntity.getDamageWobbleStrength() - g;
    if (j < 0.0F) {
        j = 0.0F;
    }
    if (h > 0.0F) {
        matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(MathHelper.sin(h) * h * j / 10.0F * (float) boatEntity.getDamageWobbleSide()));
    }
    float k = boatEntity.interpolateBubbleWobble(g);
    if (!MathHelper.approximatelyEquals(k, 0.0F)) {
        matrixStack.multiply(new Quaternion(new Vec3f(1.0F, 0.0F, 1.0F), boatEntity.interpolateBubbleWobble(g), true));
    }
    Identifier texture = this.texture;
    MangroveBoatEntityModel model = this.model;
    Identifier identifier = texture;
    MangroveBoatEntityModel boatEntityModel = model;
    matrixStack.scale(-1.0F, -1.0F, 1.0F);
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90.0F));
    boatEntityModel.setAngles(boatEntity, g, 0.0F, -0.1F, 0.0F, 0.0F);
    VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(boatEntityModel.getLayer(identifier));
    boatEntityModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
    if (!boatEntity.isSubmergedInWater()) {
        VertexConsumer vertexConsumer2 = vertexConsumerProvider.getBuffer(RenderLayer.getWaterMask());
        boatEntityModel.getWaterPatch().render(matrixStack, vertexConsumer2, i, OverlayTexture.DEFAULT_UV);
    }
    matrixStack.pop();
    super.render(boatEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
Also used : Identifier(net.minecraft.util.Identifier) Quaternion(net.minecraft.util.math.Quaternion) VertexConsumer(net.minecraft.client.render.VertexConsumer) Vec3f(net.minecraft.util.math.Vec3f)

Example 7 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project wildmod by Osmiooo.

the class ChestBoatEntityRenderer method render.

public void render(ChestBoatEntity boatEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    matrixStack.push();
    matrixStack.translate(0.0D, 0.375D, 0.0D);
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180.0F - f));
    float h = (float) boatEntity.getDamageWobbleTicks() - g;
    float j = boatEntity.getDamageWobbleStrength() - g;
    if (j < 0.0F) {
        j = 0.0F;
    }
    if (h > 0.0F) {
        matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(MathHelper.sin(h) * h * j / 10.0F * (float) boatEntity.getDamageWobbleSide()));
    }
    float k = boatEntity.interpolateBubbleWobble(g);
    if (!MathHelper.approximatelyEquals(k, 0.0F)) {
        matrixStack.multiply(new Quaternion(new Vec3f(1.0F, 0.0F, 1.0F), boatEntity.interpolateBubbleWobble(g), true));
    }
    Pair<Identifier, ChestBoatEntityModel> pair = (Pair) this.texturesAndModels.get(boatEntity.getBoatType());
    Identifier identifier = (Identifier) pair.getFirst();
    ChestBoatEntityModel boatEntityModel = (ChestBoatEntityModel) pair.getSecond();
    matrixStack.scale(-1.0F, -1.0F, 1.0F);
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90.0F));
    boatEntityModel.setAngles(boatEntity, g, 0.0F, -0.1F, 0.0F, 0.0F);
    VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(boatEntityModel.getLayer(identifier));
    boatEntityModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
    if (!boatEntity.isSubmergedInWater()) {
        VertexConsumer vertexConsumer2 = vertexConsumerProvider.getBuffer(RenderLayer.getWaterMask());
        boatEntityModel.getWaterPatch().render(matrixStack, vertexConsumer2, i, OverlayTexture.DEFAULT_UV);
    }
    matrixStack.pop();
    super.render(boatEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
Also used : Identifier(net.minecraft.util.Identifier) Quaternion(net.minecraft.util.math.Quaternion) VertexConsumer(net.minecraft.client.render.VertexConsumer) Vec3f(net.minecraft.util.math.Vec3f) Pair(com.mojang.datafixers.util.Pair)

Example 8 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project wildmod by Osmiooo.

the class WardenEntityDotFeatureRenderer method render.

@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WardenEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    if (entity.shouldRender) {
        VertexConsumer vertexConsumer = vertexConsumers.getBuffer(this.OVERLAY);
        int a = calculateLight(getBlockLight(entity, entity.getBlockPos()));
        float b = colors(entity.getWorld().getTime());
        this.getContextModel().render(matrices, vertexConsumer, a, OverlayTexture.DEFAULT_UV, b, b, b, 1.0f);
    }
}
Also used : VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 9 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project wildmod by Osmiooo.

the class WardenEntityEmissiveFeatureRenderer method render.

@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WardenEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    ;
    if (entity.shouldRender) {
        String string = Formatting.strip(entity.getName().getString());
        VertexConsumer vertexConsumer = vertexConsumers.getBuffer(this.OVERLAY);
        if ("Osmiooo".equals(string)) {
            vertexConsumer = vertexConsumers.getBuffer(this.SECRET_OVERLAY);
        }
        this.getContextModel().render(matrices, vertexConsumer, 15728640, OverlayTexture.DEFAULT_UV, 1.0f, 1.0f, 1.0f, 1.0f);
    }
}
Also used : VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 10 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project wildmod by Osmiooo.

the class WardenEntityTendrilsFeatureRenderer method render.

@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WardenEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    if (entity.shouldRender) {
        String string = Formatting.strip(entity.getName().getString());
        VertexConsumer vertexConsumer = vertexConsumers.getBuffer(this.TENDRILS);
        if ("Osmiooo".equals(string)) {
            vertexConsumer = vertexConsumers.getBuffer(this.SECRET_TENDRILS);
        }
        this.getContextModel().render(matrices, vertexConsumer, (int) calculateLight(entity), OverlayTexture.DEFAULT_UV, calculateColors(entity), calculateColors(entity), calculateColors(entity), 1.0f);
    }
}
Also used : 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