Search in sources :

Example 1 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project MCDoom by AzureDoom.

the class ChaingunMobRender method render.

@Override
public void render(ChaingunMobEntity persistentProjectileEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    matrixStack.push();
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(MathHelper.lerp(g, persistentProjectileEntity.prevYaw, persistentProjectileEntity.getYaw()) - 90.0F));
    matrixStack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(MathHelper.lerp(g, persistentProjectileEntity.prevPitch, persistentProjectileEntity.getPitch())));
    matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(45.0F));
    matrixStack.scale(0.05625F, 0.05625F, 0.05625F);
    matrixStack.translate(-4.0D, 0.0D, 0.0D);
    VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(persistentProjectileEntity)));
    MatrixStack.Entry entry = matrixStack.peek();
    Matrix4f matrix4f = entry.getPositionMatrix();
    Matrix3f matrix3f = entry.getNormalMatrix();
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, i);
    for (int u = 0; u < 4; ++u) {
        matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90.0F));
        this.method_23153(matrix4f, matrix3f, vertexConsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, i);
    }
    matrixStack.pop();
    super.render(persistentProjectileEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Matrix3f(net.minecraft.util.math.Matrix3f) MatrixStack(net.minecraft.client.util.math.MatrixStack) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 2 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project MCDoom by AzureDoom.

the class DroneBoltRender method render.

@Override
public void render(DroneBoltEntity persistentProjectileEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    matrixStack.push();
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(MathHelper.lerp(g, persistentProjectileEntity.prevYaw, persistentProjectileEntity.getYaw()) - 90.0F));
    matrixStack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(MathHelper.lerp(g, persistentProjectileEntity.prevPitch, persistentProjectileEntity.getPitch())));
    matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(45.0F));
    matrixStack.scale(0.05625F, 0.05625F, 0.05625F);
    matrixStack.translate(-4.0D, 0.0D, 0.0D);
    VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(persistentProjectileEntity)));
    MatrixStack.Entry entry = matrixStack.peek();
    Matrix4f matrix4f = entry.getPositionMatrix();
    Matrix3f matrix3f = entry.getNormalMatrix();
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, i);
    this.method_23153(matrix4f, matrix3f, vertexConsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, i);
    for (int u = 0; u < 4; ++u) {
        matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90.0F));
        this.method_23153(matrix4f, matrix3f, vertexConsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, i);
        this.method_23153(matrix4f, matrix3f, vertexConsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, i);
    }
    matrixStack.pop();
    super.render(persistentProjectileEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Matrix3f(net.minecraft.util.math.Matrix3f) MatrixStack(net.minecraft.client.util.math.MatrixStack) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 3 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project MCDoom by AzureDoom.

the class BFGCellRender method renderCrystalBeam.

public static void renderCrystalBeam(float dx, float dy, float dz, float tickDelta, int age, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
    float f = MathHelper.sqrt(dx * dx + dz * dz);
    float g = MathHelper.sqrt(dx * dx + dy * dy + dz * dz);
    matrices.push();
    matrices.translate(0.0D, 1.0D, 0.0D);
    matrices.multiply(Vec3f.POSITIVE_Y.getRadialQuaternion((float) (-Math.atan2((double) dz, (double) dx)) - 1.5707964F));
    matrices.multiply(Vec3f.POSITIVE_X.getRadialQuaternion((float) (-Math.atan2((double) f, (double) dy)) - 1.5707964F));
    VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER);
    float h = 0.0F - ((float) age + tickDelta) * 0.01F;
    float i = MathHelper.sqrt(dx * dx + dy * dy + dz * dz) / 32.0F - ((float) age + tickDelta) * 0.01F;
    float k = 0.0F;
    float l = 0.75F;
    float m = 0.0F;
    MatrixStack.Entry entry = matrices.peek();
    Matrix4f matrix4f = entry.getPositionMatrix();
    Matrix3f matrix3f = entry.getNormalMatrix();
    for (int n = 1; n <= 8; ++n) {
        float o = MathHelper.sin((float) n * 6.2831855F / 8.0F) * 0.75F;
        float p = MathHelper.cos((float) n * 6.2831855F / 8.0F) * 0.75F;
        float q = (float) n / 8.0F;
        vertexConsumer.vertex(matrix4f, k * 0.2F, l * 0.2F, 0.0F).color(0, 0, 0, 255).texture(m, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
        vertexConsumer.vertex(matrix4f, k, l, g).color(255, 255, 255, 255).texture(m, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
        vertexConsumer.vertex(matrix4f, o, p, g).color(255, 255, 255, 255).texture(q, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
        vertexConsumer.vertex(matrix4f, o * 0.2F, p * 0.2F, 0.0F).color(0, 0, 0, 255).texture(q, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
        k = o;
        l = p;
        m = q;
    }
    matrices.pop();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Matrix3f(net.minecraft.util.math.Matrix3f) MatrixStack(net.minecraft.client.util.math.MatrixStack) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 4 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project BleachHack by BleachDrinker420.

the class Peek method drawMapToolTip.

public void drawMapToolTip(MatrixStack matrices, Slot slot, int mouseX, int mouseY) {
    if (slot.getStack().getItem() != Items.FILLED_MAP) {
        return;
    }
    Integer id = FilledMapItem.getMapId(slot.getStack());
    MapState mapState = FilledMapItem.getMapState(id, mc.world);
    if (mapState == null) {
        return;
    }
    float scale = getSetting(2).asToggle().getChild(0).asSlider().getValueFloat() / 1.25f;
    matrices.push();
    matrices.translate(mouseX + 14, mouseY - 18 - 135 * scale, 0);
    matrices.scale(scale, scale, 0.0078125f);
    VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
    VertexConsumer backgroundVertexer = immediate.getBuffer(MAP_BACKGROUND_CHECKERBOARD);
    Matrix4f matrix4f = matrices.peek().getModel();
    backgroundVertexer.vertex(matrix4f, -7f, 135f, -10f).color(255, 255, 255, 255).texture(0f, 1f).light(0xf000f0).next();
    backgroundVertexer.vertex(matrix4f, 135f, 135f, -10f).color(255, 255, 255, 255).texture(1f, 1f).light(0xf000f0).next();
    backgroundVertexer.vertex(matrix4f, 135f, -7f, -10f).color(255, 255, 255, 255).texture(1f, 0f).light(0xf000f0).next();
    backgroundVertexer.vertex(matrix4f, -7f, -7f, -10f).color(255, 255, 255, 255).texture(0f, 0f).light(0xf000f0).next();
    mc.gameRenderer.getMapRenderer().draw(matrices, immediate, id, mapState, false, 0xf000f0);
    immediate.draw();
    matrices.pop();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) MapState(net.minecraft.item.map.MapState) VertexConsumer(net.minecraft.client.render.VertexConsumer) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider)

Example 5 with VertexConsumer

use of net.minecraft.client.render.VertexConsumer in project beebuddy by queenofthebees.

the class HeadFriendFeatureRenderer method render.

@Override
public void render(MatrixStack matrices, VertexConsumerProvider vcp, int light, T player, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    IFriendlyPlayer friend = (IFriendlyPlayer) (Object) player;
    if (friend.beebuddy$hasHeadFriend()) {
        CompoundTag t = friend.beebuddy$getHeadFriendNbt();
        if (fake == null) {
            fake = new FakeBeeEntity(player.world);
        }
        Identifier tex = null;
        if (t.contains("BeeBuddyNectar")) {
            String type = t.getString("BeeBuddyNectar");
            if (!t.getString("BeeBuddyNectar").equals("default")) {
                String texture = "textures/entity/bee/" + type + "_bee.png";
                tex = new Identifier("beebuddy", texture);
            }
        }
        if (tex == null) {
            tex = new Identifier("textures/entity/bee/bee.png");
        }
        VertexConsumer v = vcp.getBuffer(bee.getLayer(tex));
        ModelPart h = this.getContextModel().getHead();
        matrices.push();
        if (player.isInSneakingPose()) {
            // offsets from BipedEntityModel
            matrices.translate(0F, 0.2625F, 0F);
        }
        matrices.multiply(Vector3f.POSITIVE_Z.getRadialQuaternion(h.roll));
        matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(h.yaw));
        matrices.multiply(Vector3f.POSITIVE_X.getRadialQuaternion(h.pitch));
        float ageMod = t.getInt("Age") >= 0 ? 2F : 1F;
        float headPos = player.isInSneakingPose() ? -1.4875F : -1.5F;
        matrices.translate(0F, ageMod * headPos - 0.4375, 0F);
        matrices.scale(ageMod, ageMod, ageMod);
        BeeEntityModelAccessor bea = (BeeEntityModelAccessor) (Object) bee;
        bee.setAngles(fake, 0F, 0F, animationProgress, 0F, 0F);
        bea.beebuddy$getBody().pitch = 0F;
        bea.beebuddy$getBody().pivotY = 19F;
        bee.render(matrices, v, light, OverlayTexture.DEFAULT_UV, 1F, 1F, 1F, 1F);
        matrices.pop();
    }
}
Also used : IFriendlyPlayer(nomble.beebuddy.duck.IFriendlyPlayer) Identifier(net.minecraft.util.Identifier) ModelPart(net.minecraft.client.model.ModelPart) BeeEntityModelAccessor(nomble.beebuddy.client.mixin.accessor.BeeEntityModelAccessor) VertexConsumer(net.minecraft.client.render.VertexConsumer) CompoundTag(net.minecraft.nbt.CompoundTag)

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