Search in sources :

Example 1 with PartialItemModelRenderer

use of com.simibubi.create.foundation.item.render.PartialItemModelRenderer in project Create by Creators-of-Create.

the class LecternControllerRenderer method renderSafe.

@Override
protected void renderSafe(LecternControllerTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
    ItemStack stack = AllItems.LINKED_CONTROLLER.asStack();
    TransformType transformType = TransformType.NONE;
    LinkedControllerModel mainModel = (LinkedControllerModel) Minecraft.getInstance().getItemRenderer().getModel(stack, te.getLevel(), null, 0);
    PartialItemModelRenderer renderer = PartialItemModelRenderer.of(stack, transformType, ms, buffer, overlay);
    boolean active = te.hasUser();
    boolean renderDepression = te.isUsedBy(Minecraft.getInstance().player);
    Direction facing = te.getBlockState().getValue(LecternControllerBlock.FACING);
    TransformStack msr = TransformStack.cast(ms);
    ms.pushPose();
    msr.translate(0.5, 1.45, 0.5);
    msr.rotateY(AngleHelper.horizontalAngle(facing) - 90);
    msr.translate(0.28, 0, 0);
    msr.rotateZ(-22.0);
    LinkedControllerItemRenderer.renderInLectern(stack, mainModel, renderer, transformType, ms, light, active, renderDepression);
    ms.popPose();
}
Also used : PartialItemModelRenderer(com.simibubi.create.foundation.item.render.PartialItemModelRenderer) TransformStack(com.jozufozu.flywheel.util.transform.TransformStack) ItemStack(net.minecraft.world.item.ItemStack) TransformType(net.minecraft.client.renderer.block.model.ItemTransforms.TransformType) Direction(net.minecraft.core.Direction)

Aggregations

TransformStack (com.jozufozu.flywheel.util.transform.TransformStack)1 PartialItemModelRenderer (com.simibubi.create.foundation.item.render.PartialItemModelRenderer)1 TransformType (net.minecraft.client.renderer.block.model.ItemTransforms.TransformType)1 Direction (net.minecraft.core.Direction)1 ItemStack (net.minecraft.world.item.ItemStack)1