use of com.tangykiwi.kiwiclient.modules.other.Cape in project KiwiClient by TangyKiwi.
the class CapeRenderer method render.
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, AbstractClientPlayerEntity abstractClientPlayerEntity, float f, float g, float h, float j, float k, float l) {
if (!(MinecraftClient.getInstance().currentScreen instanceof MainMenu) && KiwiClient.moduleManager.getModule(Cape.class).isEnabled() && !abstractClientPlayerEntity.isInvisible() && abstractClientPlayerEntity.isPartVisible(PlayerModelPart.CAPE) && abstractClientPlayerEntity.getName().equals(MinecraftClient.getInstance().player.getName())) {
ItemStack itemStack = abstractClientPlayerEntity.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.getItem() != Items.ELYTRA) {
matrixStack.push();
matrixStack.translate(0.0D, 0.0D, 0.125D);
double d = MathHelper.lerp(h, abstractClientPlayerEntity.prevCapeX, abstractClientPlayerEntity.capeX) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevX, abstractClientPlayerEntity.getX());
double e = MathHelper.lerp(h, abstractClientPlayerEntity.prevCapeY, abstractClientPlayerEntity.capeY) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevY, abstractClientPlayerEntity.getY());
double m = MathHelper.lerp(h, abstractClientPlayerEntity.prevCapeZ, abstractClientPlayerEntity.capeZ) - MathHelper.lerp((double) h, abstractClientPlayerEntity.prevZ, abstractClientPlayerEntity.getZ());
float n = abstractClientPlayerEntity.prevBodyYaw + (abstractClientPlayerEntity.bodyYaw - abstractClientPlayerEntity.prevBodyYaw);
double o = MathHelper.sin(n * 0.017453292F);
double p = -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 vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getArmorCutoutNoCull(((Cape) KiwiClient.moduleManager.getModule(Cape.class)).getCape()), false, KiwiClient.moduleManager.getModule(Cape.class).getSettings().get(1).asToggle().state);
this.getContextModel().renderCape(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV);
matrixStack.pop();
}
}
}
use of com.tangykiwi.kiwiclient.modules.other.Cape in project KiwiClient by TangyKiwi.
the class ElytraRenderer method render.
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, AbstractClientPlayerEntity livingEntity, float f, float g, float h, float j, float k, float l) {
ItemStack itemStack = livingEntity.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.getItem() == Items.ELYTRA) {
Identifier resourcelocation;
if (KiwiClient.moduleManager.getModule(Cape.class).isEnabled() && ((Cape) KiwiClient.moduleManager.getModule(Cape.class)).getCape() != null && livingEntity.isPartVisible(PlayerModelPart.CAPE) && livingEntity.getName().equals(MinecraftClient.getInstance().player.getName())) {
resourcelocation = ((Cape) KiwiClient.moduleManager.getModule(Cape.class)).getCape();
} else {
resourcelocation = SKIN;
}
matrixStack.push();
matrixStack.translate(0.0D, 0.0D, 0.125D);
this.getContextModel().copyStateTo(this.elytra);
this.elytra.setAngles(livingEntity, f, g, j, k, l);
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getArmorCutoutNoCull(resourcelocation), false, itemStack.hasGlint());
this.elytra.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.pop();
}
}
Aggregations