Skip to content

Commit

Permalink
Render used crucifix correctly regardless of used hand
Browse files Browse the repository at this point in the history
  • Loading branch information
maxanier committed Oct 15, 2023
1 parent 60bcd8a commit 10b866f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ public void onRenderLivingPre(RenderLivingEvent.@NotNull Pre<Player, PlayerModel
@SubscribeEvent
public void onRenderFirstPersonHand(@NotNull RenderHandEvent event) {
LocalPlayer player = Minecraft.getInstance().player;
if (player != null && event.getHand() == InteractionHand.MAIN_HAND && player.isUsingItem() && player.getUseItemRemainingTicks() > 0) {
if (player.getMainHandItem().getItem() instanceof CrucifixItem) {
int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
if (player != null && player.isUsingItem() && player.getUseItemRemainingTicks() > 0 && event.getHand() == player.getUsedItemHand()) {
if (event.getItemStack().getItem() instanceof CrucifixItem) {
HumanoidArm humanoidarm = event.getHand() == InteractionHand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
int i = humanoidarm == HumanoidArm.RIGHT ? 1 : -1;
event.getPoseStack().translate(((float) -i * 0.56F), -0.0, -0.2F);
}
}
Expand Down

0 comments on commit 10b866f

Please sign in to comment.