Java Code Examples for net.minecraft.client.render.VertexConsumerProvider#getBuffer()
The following examples show how to use
net.minecraft.client.render.VertexConsumerProvider#getBuffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CapeFeature.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { M model = getContextModel(); if (player.hasSkinTexture() && !player.isInvisible() && player.isPartVisible(PlayerModelPart.CAPE) && player.getCapeTexture() != null && player.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.ELYTRA) { stack.push(); model.transform(BodyPart.BODY, stack); stack.translate(0, 0.24F, 0); model.getBodyPart(BodyPart.BODY).rotate(stack); double capeX = MathHelper.lerp(tickDelta, player.capeX, player.prevCapeX) - MathHelper.lerp(tickDelta, player.prevX, player.getX()); double capeY = MathHelper.lerp(tickDelta, player.capeY, player.prevCapeY) - MathHelper.lerp(tickDelta, player.prevY, player.getY()); double capeZ = MathHelper.lerp(tickDelta, player.capeZ, player.prevCapeZ) - MathHelper.lerp(tickDelta, player.prevZ, player.getZ()); float motionYaw = player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw); double sin = MathHelper.sin(motionYaw * PI / 180); double cos = (-MathHelper.cos(motionYaw * PI / 180)); float capeMotionY = (float) capeY * 10; if (capeMotionY < -6) capeMotionY = -6; if (capeMotionY > 32) capeMotionY = 32; float capeMotionX = (float) (capeX * sin + capeZ * cos) * 100; float diagMotion = (float) (capeX * cos - capeZ * sin) * 100; if (capeMotionX < 0) capeMotionX = 0; float camera = MathHelper.lerp(tickDelta, player.prevStrideDistance, player.strideDistance); capeMotionY += MathHelper.sin(MathHelper.lerp(tickDelta, player.prevHorizontalSpeed, player.horizontalSpeed) * 6) * 32 * camera; stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(2 + capeMotionX / 12 + capeMotionY)); stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion( diagMotion / 2)); stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-diagMotion / 2)); stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(180)); stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90)); VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture())); model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV); stack.pop(); } }
Example 2
Source File: AbstractClothingFeature.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { M overlayModel = getOverlayModel(); renderer.getModel().setAttributes(overlayModel); overlayModel.animateModel(entity, limbDistance, limbAngle, tickDelta); overlayModel.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); VertexConsumer vertexConsumer = renderContext.getBuffer(overlayModel.getLayer(getOverlayTexture())); overlayModel.render(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); }
Example 3
Source File: DJPon3Feature.java From MineLittlePony with MIT License | 4 votes |
@Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { if ("deadmau5".equals(entity.getName().getString())) { stack.push(); M body = getModelWrapper().getBody(); body.transform(BodyPart.HEAD, stack); body.getHead().rotate(stack); stack.scale(1.3333334F, 1.3333334F, 1.3333334F); stack.translate(0, 0.3F, 0); deadMau5.setVisible(true); VertexConsumer vertices = renderContext.getBuffer(deadMau5.getLayer(entity.getSkinTexture())); deadMau5.render(stack, vertices, OverlayTexture.DEFAULT_UV, lightUv, limbDistance, limbAngle, tickDelta, 1); stack.pop(); } }
Example 4
Source File: GearFeature.java From MineLittlePony with MIT License | 4 votes |
private void renderGear(M model, T entity, IGear gear, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, float limbDistance, float limbAngle, float tickDelta) { gear.setLivingAnimations(model, entity); gear.setRotationAndAngles(model.getAttributes().isGoingFast, entity.getUuid(), limbDistance, limbAngle, model.getWobbleAmount(), tickDelta); RenderLayer layer = RenderLayer.getEntityTranslucent(gear.getTexture(entity, getContext())); VertexConsumer vertexConsumer = renderContext.getBuffer(layer); gear.renderPart(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1, entity.getUuid()); }
Example 5
Source File: PonySkullRenderer.java From MineLittlePony with MIT License | 3 votes |
boolean renderSkull(@Nullable Direction direction, float angle, SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { ISkull skull = skullMap.get(skullType); if (skull == null || !skull.canRender(MineLittlePony.getInstance().getConfig())) { return false; } Identifier skin = skull.getSkinResource(profile); skull.bindPony(MineLittlePony.getInstance().getManager().getPony(skin)); stack.push(); handleRotation(stack, direction); stack.scale(-1, -1, 1); VertexConsumer vertices = renderContext.getBuffer(LevitatingItemRenderer.getRenderLayer(skin)); skull.setAngles(angle, poweredTicks); skull.render(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); stack.pop(); return true; }