net.minecraft.client.render.VertexConsumerProvider Java Examples
The following examples show how to use
net.minecraft.client.render.VertexConsumerProvider.
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: MixinSpriteIdentifier.java From MineLittlePony with MIT License | 6 votes |
@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 #2
Source File: ElytraFeature.java From MineLittlePony with MIT License | 6 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) { 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 #3
Source File: PassengerFeature.java From MineLittlePony with MIT License | 6 votes |
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 #4
Source File: HeldItemFeature.java From MineLittlePony with MIT License | 6 votes |
private void renderHeldItem(T entity, ItemStack drop, ModelTransformation.Mode transform, Arm arm, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { if (!drop.isEmpty()) { stack.push(); renderArm(arm, stack); if (getContextModel().getAttributes().isCrouching) { stack.translate(0, 0.2F, 0); } float left = arm == Arm.LEFT ? 1 : -1; if (entity.hasVehicle()) { stack.translate(left / 10, -0.2F, -0.5F); } stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-90)); stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(left * 180)); stack.translate(left * -0.2F, 0, 0); preItemRender(entity, drop, transform, arm, stack); MinecraftClient.getInstance().getItemRenderer().renderItem(entity, drop, transform, arm == Arm.LEFT, stack, renderContext, entity.world, lightUv, OverlayTexture.DEFAULT_UV); postItemRender(entity, drop, transform, arm, stack, renderContext); stack.pop(); } }
Example #5
Source File: LevitatingItemRenderer.java From MineLittlePony with MIT License | 6 votes |
/** * Renders a magical overlay over an item in third person. */ public void renderItemGlow(LivingEntity entity, ItemStack drop, ModelTransformation.Mode transform, Arm hand, int glowColor, MatrixStack stack, VertexConsumerProvider renderContext) { setColor(glowColor); stack.push(); ItemRenderer renderItem = MinecraftClient.getInstance().getItemRenderer(); stack.scale(1.1F, 1.1F, 1.1F); stack.translate(0.01F, 0.01F, 0.01F); renderItem.renderItem(entity, drop, transform, hand == Arm.LEFT, stack, renderContext, entity.world, 0x0F00F0, OverlayTexture.DEFAULT_UV); stack.translate(-0.02F, -0.02F, -0.02F); renderItem.renderItem(entity, drop, transform, hand == Arm.LEFT, stack, renderContext, entity.world, 0x0F00F0, OverlayTexture.DEFAULT_UV); stack.pop(); unsetColor(); }
Example #6
Source File: PistonBlockEntityRenderer_movableTEMixin.java From fabric-carpet with MIT License | 6 votes |
@Inject(method = "render", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE) private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, float partialTicks, MatrixStack matrixStack_1, VertexConsumerProvider layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci) { if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity()) { BlockEntity carriedBlockEntity = ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity(); if (carriedBlockEntity != null) { carriedBlockEntity.setPos(pistonBlockEntity_1.getPos()); //((BlockEntityRenderDispatcherInterface) BlockEntityRenderDispatcher.INSTANCE).renderBlockEntityOffset(carriedBlockEntity, float_1, int_1, BlockRenderLayer.field_20799, bufferBuilder_1, pistonBlockEntity_1.getRenderOffsetX(float_1), pistonBlockEntity_1.getRenderOffsetY(float_1), pistonBlockEntity_1.getRenderOffsetZ(float_1)); matrixStack_1.translate( pistonBlockEntity_1.getRenderOffsetX(partialTicks), pistonBlockEntity_1.getRenderOffsetY(partialTicks), pistonBlockEntity_1.getRenderOffsetZ(partialTicks) ); BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, matrixStack_1, layeredVertexConsumerStorage_1); } } }
Example #7
Source File: ArmourFeature.java From MineLittlePony with MIT License | 6 votes |
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 #8
Source File: PlayerPonyRenderer.java From MineLittlePony with MIT License | 6 votes |
@Override public void render(AbstractClientPlayerEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { shadowRadius = manager.getShadowScale(); super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); DebugBoundingBoxRenderer.render(manager.getPony(entity), this, entity, stack, renderContext, tickDelta); // Translate the shadow position after everything is done // (shadows are drawn after us) if (!entity.hasVehicle() && !entity.isSleeping()) { float yaw = MathHelper.lerpAngleDegrees(tickDelta, entity.prevBodyYaw, entity.bodyYaw); float l = entity.getWidth() / 2 * manager.getPony(entity).getMetadata().getSize().getScaleFactor(); stack.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(yaw)); stack.translate(0, 0, -l); } }
Example #9
Source File: PlayerPonyRenderer.java From MineLittlePony with MIT License | 6 votes |
protected void renderArm(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, Arm side) { manager.updateModel(player, Mode.FIRST_PERSON); stack.push(); float reflect = side == Arm.LEFT ? 1 : -1; stack.translate(reflect * 0.1F, -0.54F, 0); if (side == Arm.LEFT) { super.renderLeftArm(stack, renderContext, lightUv, player); } else { super.renderRightArm(stack, renderContext, lightUv, player); } stack.pop(); }
Example #10
Source File: IllagerPonyRenderer.java From MineLittlePony with MIT License | 6 votes |
@Override public void render(IllusionerEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { if (entity.isInvisible()) { Vec3d[] clones = entity.method_7065(tickDelta); float rotation = getAnimationProgress(entity, tickDelta); for (int i = 0; i < clones.length; ++i) { stack.push(); stack.translate( clones[i].x + MathHelper.cos(i + rotation * 0.5F) * 0.025D, clones[i].y + MathHelper.cos(i + rotation * 0.75F) * 0.0125D, clones[i].z + MathHelper.cos(i + rotation * 0.7F) * 0.025D ); super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); stack.pop(); } } else { super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); } }
Example #11
Source File: PonyStandRenderer.java From MineLittlePony with MIT License | 6 votes |
@Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, ArmorStandEntity entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { if (entity.hasCustomName() && "Ponita".equals(entity.getCustomName().asString())) { headPitch = 0.017453292F * entity.getHeadRotation().getPitch(); headYaw = 0.017453292F * entity.getHeadRotation().getYaw(); pony.getBody().animateModel(entity, limbDistance, limbAngle, tickDelta); pony.getBody().setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); for (EquipmentSlot i : EquipmentSlot.values()) { if (i.getType() == EquipmentSlot.Type.ARMOR) { ArmourFeature.renderArmor(pony, stack, renderContext, lightUv, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.INNER); ArmourFeature.renderArmor(pony, stack, renderContext, lightUv, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.OUTER); } } } else { super.render(stack, renderContext, lightUv, entity, limbDistance, limbAngle, tickDelta, age, headYaw, headPitch); } }
Example #12
Source File: HallowedTreasureChestEntityRenderer.java From the-hallow with MIT License | 6 votes |
@Override public void render(HallowedTreasureChestEntity chest, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) { matrixStack.push(); // initial size and position matrixStack.translate(-0.275, 0.57, 0.275); matrixStack.multiply(INITIAL_ROTATION_X); matrixStack.scale(0.57f, 0.57f, 0.57f); // calculate interpolated render rotation from last rotation float interpolated = chest.previousRotation + (chest.rotation - chest.previousRotation) * tickDelta; matrixStack.translate(0.5, 0.5, 0.5); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(interpolated)); matrixStack.translate(-0.5, -0.5, -0.5); // jiggle after finishing spin if (chest.getEndProgress() != 0) { matrixStack.translate(0.5, 0.5, 0.5); matrixStack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion((float) MathHelper.sin(chest.getEndProgress()))); matrixStack.translate(-0.5f, -0.5f, -0.5f); } // render chest updateHingeProgress(chest, chestModel); chestModel.render(matrixStack, vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(TEXTURE)), light, OverlayTexture.DEFAULT_UV, 1f, 1f, 1f, 1f); // finish matrixStack.pop(); }
Example #13
Source File: MixinSkullBlockEntityRenderer.java From MineLittlePony with MIT License | 6 votes |
@Inject(method = "render(" + "Lnet/minecraft/util/math/Direction;" + "F" + "Lnet/minecraft/block/SkullBlock$SkullType;" + "Lcom/mojang/authlib/GameProfile;" + "F" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;" + "I" + ")V", at = @At("HEAD"), cancellable = true) private static void onRender(@Nullable Direction direction, float angle, SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, CallbackInfo info) { if (!info.isCancelled() && PonySkullRenderer.renderPonySkull(direction, angle, skullType, profile, poweredTicks, stack, renderContext, lightUv)) { info.cancel(); } }
Example #14
Source File: SkirtCostumeItem.java From the-hallow with MIT License | 6 votes |
@Override @Environment(EnvType.CLIENT) public void render(String slot, MatrixStack matrix, VertexConsumerProvider vertexConsumer, int light, PlayerEntityModel<AbstractClientPlayerEntity> model, AbstractClientPlayerEntity player, float headYaw, float headPitch) { ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); matrix.push(); translateToChest(model, player, headYaw, headPitch, matrix); //TODO switch back to trinkets version once it's fixed matrix.push(); matrix.translate(0.25, 0.65, 0); matrix.scale(0.5F, 0.5F, 0.5F); matrix.multiply(ROTATION_CONSTANT); renderer.renderItem(new ItemStack(Items.BLAZE_ROD), ModelTransformation.Mode.FIXED, light, OverlayTexture.DEFAULT_UV, matrix, vertexConsumer); matrix.pop(); matrix.push(); matrix.translate(-0.25, 0.65, 0); matrix.scale(0.5F, 0.5F, 0.5F); matrix.multiply(ROTATION_CONSTANT); renderer.renderItem(new ItemStack(Items.BLAZE_ROD), ModelTransformation.Mode.FIXED, light, OverlayTexture.DEFAULT_UV, matrix, vertexConsumer); matrix.pop(); matrix.push(); matrix.translate(0, 0.65, 0.325); matrix.scale(0.5F, 0.5F, 0.5F); matrix.multiply(ROTATION_CONSTANT); renderer.renderItem(new ItemStack(Items.BLAZE_ROD), ModelTransformation.Mode.FIXED, light, OverlayTexture.DEFAULT_UV, matrix, vertexConsumer); matrix.pop(); matrix.pop(); }
Example #15
Source File: TinyPumpkinRenderer.java From the-hallow with MIT License | 6 votes |
@Override public void render(TinyPumpkinBlockEntity pumpkin, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) { ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); matrixStack.push(); matrixStack.translate(0.5, 0.275, 0.5); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(360 - pumpkin.getCachedState().get(HorizontalFacingBlock.FACING).asRotation())); matrixStack.multiply(NINETY_DEG_X); matrixStack.scale(0.75f, 0.75f, 0.75f); matrixStack.push(); matrixStack.translate(0.25, 0, 0); matrixStack.multiply(MINUS_NINETY_DEG_Y); renderer.renderItem(pumpkin.getLeftItem(), ModelTransformation.Mode.FIXED, i, j, matrixStack, vertexConsumerProvider); matrixStack.pop(); matrixStack.push(); matrixStack.translate(-0.25, 0, 0); matrixStack.multiply(MINUS_NINETY_DEG_Y); renderer.renderItem(pumpkin.getRightItem(), ModelTransformation.Mode.FIXED, i, j, matrixStack, vertexConsumerProvider); matrixStack.pop(); matrixStack.pop(); }
Example #16
Source File: GearFeature.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) { if (entity.isInvisible()) { return; } M model = getModelWrapper().getBody(); Map<BodyPart, Float> renderStackingOffsets = new HashMap<>(); for (Map.Entry<Wearable, IGear> entry : gears.entrySet()) { Wearable wearable = entry.getKey(); IGear gear = entry.getValue(); if (getContext().shouldRender(model, entity, wearable, gear)) { stack.push(); model.transform(gear.getGearLocation(), stack); model.getBodyPart(gear.getGearLocation()).rotate(stack); if (gear instanceof IStackable) { BodyPart part = gear.getGearLocation(); renderStackingOffsets.compute(part, (k, v) -> { float offset = ((IStackable)gear).getStackingOffset(); if (v != null) { stack.translate(0, -v, 0); offset += v; } return offset; }); } renderGear(model, entity, gear, stack, renderContext, lightUv, limbDistance, limbAngle, tickDelta); stack.pop(); } } }
Example #17
Source File: NpcClothingFeature.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(MatrixStack matrixStack, VertexConsumerProvider provider, int i, T entity, float f, float g, float h, float j, float k, float l) { if (!entity.isInvisible()) { VillagerData data = entity.getVillagerData(); VillagerType type = data.getType(); VillagerProfession profession = data.getProfession(); HatType typeHatLayer = getHatType(typeHatCache, "type", Registry.VILLAGER_TYPE, type); HatType profHatLayer = getHatType(profHatCache, "profession", Registry.VILLAGER_PROFESSION, profession); M entityModel = getContextModel(); entityModel.setHatVisible( profHatLayer == VillagerResourceMetadata.HatType.NONE || (profHatLayer == VillagerResourceMetadata.HatType.PARTIAL && typeHatLayer != VillagerResourceMetadata.HatType.FULL) ); Identifier typeSkin = findTexture("type", Registry.VILLAGER_TYPE.getId(type)); getContext().getInternalRenderer().updateMetadata(typeSkin); renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1); entityModel.setHatVisible(true); if (profession != VillagerProfession.NONE && !entity.isBaby()) { Identifier professionSkin = findTexture("profession", Registry.VILLAGER_PROFESSION.getId(profession)); getContext().getInternalRenderer().updateMetadata(professionSkin); renderModel(entityModel, professionSkin, matrixStack, provider, i, entity, 1, 1, 1); if (profession != VillagerProfession.NITWIT) { Identifier levelSkin = findTexture("profession_level", LEVEL_TO_ID.get(MathHelper.clamp(data.getLevel(), 1, LEVEL_TO_ID.size()))); renderModel(entityModel, levelSkin, matrixStack, provider, i, entity, 1, 1, 1); } } } }
Example #18
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 #19
Source File: SkullFeature.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) { ItemStack itemstack = entity.getEquippedStack(EquipmentSlot.HEAD); if (!itemstack.isEmpty()) { M model = getContext().getModelWrapper().getBody(); Item item = itemstack.getItem(); stack.push(); model.transform(BodyPart.HEAD, stack); model.getHead().rotate(stack); if (model instanceof AbstractPonyModel) { stack.translate(0, 0.225F, 0); } else { stack.translate(0, 0, 0.15F); } if (item instanceof BlockItem && ((BlockItem) item).getBlock() instanceof AbstractSkullBlock) { boolean isVillager = entity instanceof VillagerDataContainer; renderSkull(stack, renderContext, itemstack, isVillager, limbDistance, lightUv); } else if (!(item instanceof ArmorItem) || ((ArmorItem)item).getSlotType() != EquipmentSlot.HEAD) { renderBlock(stack, renderContext, entity, itemstack, lightUv); } stack.pop(); } }
Example #20
Source File: SkullFeature.java From MineLittlePony with MIT License | 5 votes |
private void renderBlock(MatrixStack stack, VertexConsumerProvider renderContext, T entity, ItemStack itemstack, int lightUv) { stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(180)); stack.scale(0.625F, -0.625F, -0.625F); stack.translate(0, 0.6F, -0.21F); MinecraftClient.getInstance().getHeldItemRenderer().renderItem(entity, itemstack, ModelTransformation.Mode.HEAD, false, stack, renderContext, lightUv); }
Example #21
Source File: SkullFeature.java From MineLittlePony with MIT License | 5 votes |
private void renderSkull(MatrixStack stack, VertexConsumerProvider renderContext, ItemStack itemstack, boolean isVillager, float limbDistance, int lightUv) { stack.translate(0, 0, -0.14F); float f = 1.1875f; stack.scale(f, -f, -f); if (isVillager) { stack.translate(0, 0.0625F, 0); } GameProfile profile = null; if (itemstack.hasTag()) { CompoundTag nbt = itemstack.getTag(); assert nbt != null; if (nbt.contains("SkullOwner", 10)) { profile = NbtHelper.toGameProfile(nbt.getCompound("SkullOwner")); } else if (nbt.contains("SkullOwner", 8)) { profile = SkullBlockEntity.loadProperties(new GameProfile(null, nbt.getString("SkullOwner"))); nbt.put("SkullOwner", NbtHelper.fromGameProfile(new CompoundTag(), profile)); } } SkullType type = ((AbstractSkullBlock) ((BlockItem) itemstack.getItem()).getBlock()).getSkullType(); stack.translate(-0.5, 0, -0.5); SkullBlockEntityRenderer.render(null, 180, type, profile, limbDistance, stack, renderContext, lightUv); }
Example #22
Source File: MixinItemRenderer.java From MineLittlePony with MIT License | 5 votes |
@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())); } }
Example #23
Source File: PonySkullRenderer.java From MineLittlePony with MIT License | 5 votes |
public static boolean renderPonySkull(@Nullable Direction direction, float angle, SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { if (INSTANCE != null) { return INSTANCE.renderSkull(direction, angle, skullType, profile, poweredTicks, stack, renderContext, lightUv); } return false; }
Example #24
Source File: ArmourFeature.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) { ModelWrapper<T, M> pony = getContext().getModelWrapper(); for (EquipmentSlot i : EquipmentSlot.values()) { if (i.getType() == EquipmentSlot.Type.ARMOR) { renderArmor(pony, stack, renderContext, lightUv, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.INNER); renderArmor(pony, stack, renderContext, lightUv, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.OUTER); } } }
Example #25
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 #26
Source File: SeaponyRenderer.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(GuardianEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { IResizeable resize = (IResizeable)entity; EntityDimensions origin = resize.getCurrentSize(); // aligns the beam to their horns resize.setCurrentSize(EntityDimensions.changing(origin.width, entity instanceof ElderGuardianEntity ? 6 : 3)); super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); // The beams in RenderGuardian leave lighting disabled, so we need to change it back. #MojangPls RenderSystem.enableLighting(); resize.setCurrentSize(origin); }
Example #27
Source File: EnderStallionRenderer.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(EndermanEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { EnderStallionModel modelenderman = getModel(); modelenderman.isCarrying = entity.getCarriedBlock() != null; modelenderman.isAttacking = entity.isAngry(); if (entity.isAngry()) { stack.translate(rnd.nextGaussian() / 50, 0, rnd.nextGaussian() / 50); } super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); }
Example #28
Source File: PonyRenderer.java From MineLittlePony with MIT License | 5 votes |
@Override protected void renderLabelIfPresent(T entity, Text name, MatrixStack stack, VertexConsumerProvider renderContext, int maxDistance) { stack.push(); stack.translate(0, manager.getNamePlateYOffset(entity), 0); super.renderLabelIfPresent(entity, name, stack, renderContext, maxDistance); stack.pop(); }
Example #29
Source File: PlayerPonyRenderer.java From MineLittlePony with MIT License | 5 votes |
@Override protected void renderLabelIfPresent(AbstractClientPlayerEntity entity, Text name, MatrixStack stack, VertexConsumerProvider renderContext, int maxDistance) { stack.push(); if (entity.isSleeping()) { if (entity.getSleepingPosition().isPresent() && entity.getEntityWorld().getBlockState(entity.getSleepingPosition().get()).getBlock() instanceof BedBlock) { double bedRad = Math.toRadians(entity.getSleepingDirection().asRotation()); stack.translate(Math.cos(bedRad), 0, -Math.sin(bedRad)); } } stack.translate(0, manager.getNamePlateYOffset(entity), 0); super.renderLabelIfPresent(entity, name, stack, renderContext, maxDistance); stack.pop(); }
Example #30
Source File: HallowCharmItem.java From the-hallow with MIT License | 5 votes |
@Override public void render(String slot, MatrixStack matrix, VertexConsumerProvider vertexConsumer, int light, PlayerEntityModel<AbstractClientPlayerEntity> model, AbstractClientPlayerEntity player, float headYaw, float headPitch) { ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); matrix.push(); translateToChest(model, player, headYaw, headPitch, matrix); //TODO switch back to trinkets version once it's fixed matrix.translate(0, -0.15, 0); matrix.scale(0.5F, 0.5F, 0.5F); matrix.multiply(ROTATION_CONSTANT); renderer.renderItem(new ItemStack(HallowedItems.HALLOW_CHARM), ModelTransformation.Mode.FIXED, light, OverlayTexture.DEFAULT_UV, matrix, vertexConsumer); matrix.pop(); }