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);
}
}
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();
}
}
}
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();
}
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();
}
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);
}
}
Aggregations