net.minecraft.client.render.VertexConsumer Java Examples

The following examples show how to use net.minecraft.client.render.VertexConsumer. 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: ConfigurableElectricMachineBlockEntityRenderer.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private static void renderQuad(MatrixStack.Entry entry, VertexConsumer vertexConsumer, float f, float g, float h, List<BakedQuad> list, int i, int j) {
    BakedQuad bakedQuad;
    float n;
    float o;
    float p;
    for (Iterator<BakedQuad> var8 = list.iterator(); var8.hasNext(); vertexConsumer.quad(entry, bakedQuad, n, o, p, i, j)) {
        bakedQuad = var8.next();
        if (bakedQuad.hasColor()) {
            n = MathHelper.clamp(f, 0.0F, 1.0F);
            o = MathHelper.clamp(g, 0.0F, 1.0F);
            p = MathHelper.clamp(h, 0.0F, 1.0F);
        } else {
            n = 1.0F;
            o = 1.0F;
            p = 1.0F;
        }
    }

}
 
Example #2
Source File: MixinSpriteIdentifier.java    From MineLittlePony with MIT License 6 votes vote down vote up
@Inject(method = "getVertexConsumer("
            + "Lnet/minecraft/client/render/VertexConsumerProvider;"
            + "Ljava/util/function/Function;"
        + ")"
        + "Lnet/minecraft/client/render/VertexConsumer;",
        at = @At("HEAD"),
        cancellable = true
)
public void onGetBuffer(VertexConsumerProvider provider, Function<Identifier, RenderLayer> layerFunction, CallbackInfoReturnable<VertexConsumer> info) {
    if (LevitatingItemRenderer.usesTransparency()) {
        SpriteIdentifier self = (SpriteIdentifier)(Object)this;

        info.setReturnValue(self.getSprite().getTextureSpecificVertexConsumer(provider.getBuffer(LevitatingItemRenderer.getRenderLayer(self.getAtlasId()))));
    }
}
 
Example #3
Source File: ArmourFeature.java    From MineLittlePony with MIT License 6 votes vote down vote up
private static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmourPart(
        MatrixStack matrices, VertexConsumerProvider provider,
        int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver<T> resolver, ArmourLayer layer, Identifier texture) {

    VertexConsumer vertices = ItemRenderer.method_27952(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint);

    model.setVariant(resolver.getArmourVariant(layer, texture));
    model.render(matrices, vertices, light, OverlayTexture.DEFAULT_UV, r, g, b, 1);
}
 
Example #4
Source File: PassengerFeature.java    From MineLittlePony with MIT License 6 votes vote down vote up
private void renderShoulderParrot(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float headYaw, float headPitch, boolean left) {

        CompoundTag riderTag = left ? entity.getShoulderEntityLeft() : entity.getShoulderEntityRight();

        EntityType.get(riderTag.getString("id")).filter(p -> p == EntityType.PARROT).ifPresent((entityType) -> {
           stack.push();

           getContextModel().transform(BodyPart.BODY, stack);

           stack.translate(left ? 0.25 : -0.25, entity.isInSneakingPose() ? -0.5 : -0.25, 0.35);
           stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(left ? -5 : 5));

           VertexConsumer vertexConsumer = renderContext.getBuffer(model.getLayer(ParrotEntityRenderer.TEXTURES[riderTag.getInt("Variant")]));
           model.poseOnShoulder(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, limbDistance, limbAngle, headYaw, headPitch, entity.age);
           stack.pop();
        });
    }
 
Example #5
Source File: ElytraFeature.java    From MineLittlePony with MIT License 6 votes vote down vote up
@Override
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
    ItemStack itemstack = entity.getEquippedStack(EquipmentSlot.CHEST);

    if (itemstack.getItem() == Items.ELYTRA) {
        stack.push();
        preRenderCallback(stack);

        EntityModel<T> elytra = getElytraModel();

        getContextModel().copyStateTo(elytra);
        if (elytra instanceof PonyElytra) {
            ((PonyElytra<T>)elytra).isSneaking = getContext().getEntityPony(entity).isCrouching(entity);
        }

        elytra.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch);
        VertexConsumer vertexConsumer = ItemRenderer.method_29711(renderContext, modelElytra.getLayer(getElytraTexture(entity)), false, itemstack.hasEnchantmentGlint());
        modelElytra.render(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);

        stack.pop();
    }
}
 
Example #6
Source File: MixinFluidRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void render(BlockRenderView extendedBlockView_1, BlockPos blockPos_1, VertexConsumer vertexConsumer_1, FluidState fluidState_1, CallbackInfoReturnable<Boolean> callbackInfo) {
    Xray xray = (Xray) ModuleManager.getModule(Xray.class);
    if (xray.getSettings().get(0).toToggle().state) return;
    if (xray.isToggled() && !xray.isVisible(fluidState_1.getBlockState().getBlock())) {
        callbackInfo.setReturnValue(false);
        callbackInfo.cancel();
    }
}
 
Example #7
Source File: ConfigurableElectricMachineBlockEntityRenderer.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
public void render(MatrixStack.Entry entry, VertexConsumer vertexConsumer, @Nullable BlockState blockState, BakedModel bakedModel, float red, float green, float blue, int[] light, int overlay) {
    Random random = new Random();
    Direction[] var13 = Direction.values();

    for (Direction direction : var13) {
        random.setSeed(42L);
        renderQuad(entry, vertexConsumer, red, green, blue, bakedModel.getQuads(blockState, direction, random), light[getId(direction)], overlay);
    }

    random.setSeed(42L);
    renderQuad(entry, vertexConsumer, red, green, blue, bakedModel.getQuads(blockState, null, random), light[getId(Direction.UP)], overlay);
}
 
Example #8
Source File: BlockModelRendererMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Shadow
public boolean renderSmooth(BlockRenderView blockRenderView_1,
	BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1,
	MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1,
	boolean boolean_1, Random random_1, long long_1, int int_1)
{
	return false;
}
 
Example #9
Source File: BlockModelRendererMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = {@At("HEAD")},
	method = {
		"renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z",
		"renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z"},
	cancellable = true)
private void onRenderSmoothOrFlat(BlockRenderView blockRenderView_1,
	BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1,
	MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1,
	boolean depthTest, Random random_1, long long_1, int int_1,
	CallbackInfoReturnable<Boolean> cir)
{
	TesselateBlockEvent event = new TesselateBlockEvent(blockState_1);
	WurstClient.INSTANCE.getEventManager().fire(event);
	
	if(event.isCancelled())
	{
		cir.cancel();
		return;
	}
	
	if(!depthTest)
		return;
	
	ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(blockState_1);
	WurstClient.INSTANCE.getEventManager().fire(event2);
	if(!Boolean.TRUE.equals(event2.isRendered()))
		return;
	
	renderSmooth(blockRenderView_1, bakedModel_1, blockState_1, blockPos_1,
		matrixStack_1, vertexConsumer_1, false, random_1, long_1, int_1);
}
 
Example #10
Source File: MixinFluidRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void render(BlockRenderView extendedBlockView_1, BlockPos blockPos_1, VertexConsumer vertexConsumer_1, FluidState fluidState_1, CallbackInfoReturnable<Boolean> callbackInfo) {
    Xray xray = (Xray) ModuleManager.getModule(Xray.class);
    if (xray.getSettings().get(0).toToggle().state) return;
    if (xray.isToggled() && !xray.isVisible(fluidState_1.getBlockState().getBlock())) {
        callbackInfo.setReturnValue(false);
        callbackInfo.cancel();
    }
}
 
Example #11
Source File: CultistModel.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int i, int j, float r, float g, float b, float f) {
	head.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	torso.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	leftArm.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	rightArm.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	leftLeg.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	rightLeg.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	cape.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
}
 
Example #12
Source File: MixinBlockModelRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void render(BlockRenderView blockRenderView_1, BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1, MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1, boolean boolean_1, Random random_1, long long_1, int int_1, CallbackInfoReturnable<Boolean> ci) {
    try {
        Xray xray = (Xray) ModuleManager.getModule(Xray.class);
        if (!xray.isVisible(blockState_1.getBlock())) {
            ci.setReturnValue(false);
            ci.cancel();
        }
    } catch (Exception ignored) {}
}
 
Example #13
Source File: TreasureChestModel.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int i, int j, float r, float g, float b, float f) {
	this.hatch.pitch = this.lid.pitch;
	this.lid.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	this.hatch.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
	this.base.render(matrixStack, vertexConsumer, i, j, r, g, b, f);
}
 
Example #14
Source File: MixinBlockModelRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void render(BlockRenderView blockRenderView_1, BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1, MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1, boolean boolean_1, Random random_1, long long_1, int int_1, CallbackInfoReturnable<Boolean> ci) {
    try {
        Xray xray = (Xray) ModuleManager.getModule(Xray.class);
        if (!xray.isVisible(blockState_1.getBlock())) {
            ci.setReturnValue(false);
            ci.cancel();
        }
    } catch (Exception ignored) {}
}
 
Example #15
Source File: AbstractClothingFeature.java    From MineLittlePony with MIT License 5 votes vote down vote up
@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 #16
Source File: EnderStallionModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    stack.push();
    stack.translate(0, -1.15F, 0);
    super.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    stack.pop();
}
 
Example #17
Source File: SeaponyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    torso.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    bodyCenter.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    torso.rotate(stack);

    tail.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId);
    leftFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    centerFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    rightFin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
}
 
Example #18
Source File: UnicornModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
protected void renderHead(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    super.renderHead(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);

    if (hasHorn()) {
        head.rotate(stack);
        horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId);
    }
}
 
Example #19
Source File: UnicornModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    super.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);

    if (hasHorn() && canCast() && isCasting()) {
        stack.push();
        transform(BodyPart.HEAD, stack);
        head.rotate(stack);
        horn.renderMagic(stack, vertices, getMagicColor());
        stack.pop();
    }
}
 
Example #20
Source File: AlicornModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    super.renderBody(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);

    if (canFly()) {
        getWings().renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId);
    }
}
 
Example #21
Source File: BatWings.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
    stack.push();
    stack.scale(1.3F, 1.3F, 1.3F);

    super.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, interpolatorId);

    stack.pop();
}
 
Example #22
Source File: PegasusWings.java    From MineLittlePony with MIT License 5 votes vote down vote up
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    if (pegasus.wingsAreOpen()) {
        extended.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    } else {
        boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS);
        if (bags) {
            stack.push();
            stack.translate(0, 0, 0.198F);
        }
        folded.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
        if (bags) {
            stack.pop();
        }
    }
}
 
Example #23
Source File: UnicornHorn.java    From MineLittlePony with MIT License 5 votes vote down vote up
public void renderMagic(MatrixStack stack, VertexConsumer verts, int tint) {
    if (visible) {
        Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();

        VertexConsumer vertices = immediate.getBuffer(MagicGlow.getRenderLayer());

        glow.render(stack, vertices, OverlayTexture.DEFAULT_UV, 0x0F00F0, Color.r(tint), Color.g(tint), Color.b(tint), 0.4F);
    }
}
 
Example #24
Source File: PonyArmourModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float limbDistance, float limbAngle, float tickDelta, float alpha) {
    if (variant == ArmourVariant.LEGACY) {
        torso.render(stack, vertices, overlayUv, lightUv, limbDistance, limbAngle, tickDelta, alpha);
        upperTorso.render(stack, vertices, overlayUv, lightUv, limbDistance, limbAngle, tickDelta, alpha);
    } else {
        chestPiece.render(stack, vertices, overlayUv, lightUv, limbDistance, limbAngle, tickDelta, alpha);
    }
}
 
Example #25
Source File: SaddleBags.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void renderPart(MatrixStack stack, VertexConsumer renderContext, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
    dropAmount = model.getMetadata().getInterpolator(interpolatorId).interpolate("dropAmount", dropAmount, 3);

    stack.push();
    stack.translate(0, dropAmount, 0);

    leftBag.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha);
    rightBag.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha);

    stack.pop();
    strap.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha);
}
 
Example #26
Source File: ChristmasHat.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
    if (tint != 0) {
        red = Color.r(tint);
        green = Color.g(tint);
        blue = Color.b(tint);
    }

    left.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    right.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
}
 
Example #27
Source File: PonySkullModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    snout.setVisible(!metadata.getRace().isHuman());
    ears.setVisible(!metadata.getRace().isHuman());

    snout.setGender(metadata.getGender());

    hair.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    skull.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);

    if (metadata.hasHorn()) {
        getHead().rotate(stack);
        horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, null);
    }
}
 
Example #28
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    renderStage(BodyPart.BODY, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderBody);
    renderStage(BodyPart.NECK, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderNeck);
    renderStage(BodyPart.HEAD, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderHead);
    renderStage(BodyPart.LEGS, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderLegs);

    if (textureHeight == 64 && getMetadata().getRace() != Race.SEAPONY) {
        renderStage(BodyPart.LEGS, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderSleeves);
        renderStage(BodyPart.BODY, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderVest);
    }

    renderStage(BodyPart.HEAD, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderHelmet);
}
 
Example #29
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
protected void renderLegs(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
    if (!isSneaking) {
        torso.rotate(stack);
    }

    leftArm.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    rightArm.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    leftLeg.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
    rightLeg.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
}
 
Example #30
Source File: MixinItemRenderer.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Inject(method = "getArmorVertexConsumer(" + VertexConsumerProvider + RenderLayer + Boolean + Boolean + ")" + VertexConsumer, at = @At("HEAD"), cancellable = true)
private static void onGetArmorVertexConsumer(VertexConsumerProvider provider, RenderLayer layer, boolean solid, boolean glint, CallbackInfoReturnable<VertexConsumer> info) {
    if (LevitatingItemRenderer.usesTransparency()) {
        info.setReturnValue(provider.getBuffer(LevitatingItemRenderer.getRenderLayer()));
    }
}