Search in sources :

Example 6 with ItemRenderer

use of net.minecraft.client.render.item.ItemRenderer in project artifality by PinkGoosik.

the class BalloonRenderer method render.

@Override
public void render(ItemStack stack, SlotReference slotReference, EntityModel<? extends LivingEntity> contextModel, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, LivingEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
    ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer();
    matrices.push();
    if (entity.isInSneakingPose())
        matrices.translate(0D, -1.25D, 0D);
    else
        matrices.translate(0D, -1.5D, 0D);
    matrices.scale(0.8F, 0.8F, 0.8F);
    matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(180.0F));
    String modelId = "artifality:balloon_in_hand#inventory";
    itemRenderer.renderItem(stack, ModelTransformation.Mode.FIXED, false, matrices, vertexConsumers, light, OverlayTexture.DEFAULT_UV, itemRenderer.getModels().getModelManager().getModel(new ModelIdentifier(modelId)));
    matrices.pop();
}
Also used : ModelIdentifier(net.minecraft.client.util.ModelIdentifier) ItemRenderer(net.minecraft.client.render.item.ItemRenderer)

Aggregations

ItemRenderer (net.minecraft.client.render.item.ItemRenderer)6 MinecraftClient (net.minecraft.client.MinecraftClient)2 ItemStack (net.minecraft.item.ItemStack)2 Subscribe (com.google.common.eventbus.Subscribe)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 Screen (net.minecraft.client.gui.screen.Screen)1 HandledScreen (net.minecraft.client.gui.screen.ingame.HandledScreen)1 ClientPlayerEntity (net.minecraft.client.network.ClientPlayerEntity)1 GameRenderer (net.minecraft.client.render.GameRenderer)1 ModelIdentifier (net.minecraft.client.util.ModelIdentifier)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 Item (net.minecraft.item.Item)1