Skip to content

Commit

Permalink
fix rendering issue with nether-knight items in its hands
Browse files Browse the repository at this point in the history
  • Loading branch information
tristankechlo committed Dec 13, 2024
1 parent 71a6914 commit f18e81d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public NetherKnightHeldItemLayer(RenderLayerParent<NetherKnightRenderState, M> r

@Override
public void render(PoseStack poseStack, MultiBufferSource buffer, int i, NetherKnightRenderState state, float f1, float f2) {
this.renderArmWithItem(state.mainHandItem, HumanoidArm.RIGHT, poseStack, buffer, i);
this.renderArmWithItem(state.offHandItem, HumanoidArm.LEFT, poseStack, buffer, i);
this.renderArmWithItem(state.rightHandItem, HumanoidArm.RIGHT, poseStack, buffer, i);
this.renderArmWithItem(state.leftHandItem, HumanoidArm.LEFT, poseStack, buffer, i);
}

private void renderArmWithItem(ItemStackRenderState heldItem, HumanoidArm hand, PoseStack poseStack, MultiBufferSource buffer, int i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public class NetherKnightRenderState extends LivingEntityRenderState implements StateFromEntity<NetherKnightEntity> {

public final ItemStackRenderState mainHandItem = new ItemStackRenderState();
public final ItemStackRenderState offHandItem = new ItemStackRenderState();
public final ItemStackRenderState rightHandItem = new ItemStackRenderState();
public final ItemStackRenderState leftHandItem = new ItemStackRenderState();
public float attackTime;
public HumanoidArm mainArm;

Expand All @@ -21,9 +21,9 @@ public void fromEntity(NetherKnightEntity entity) {
this.mainArm = entity.getMainArm();
}

public static void extractHoldingEntityRenderState(LivingEntity entity, NetherKnightRenderState reusedState, ItemModelResolver resolver) {
resolver.updateForLiving(reusedState.mainHandItem, entity.getMainHandItem(), ItemDisplayContext.GROUND, false, entity);
resolver.updateForLiving(reusedState.offHandItem, entity.getOffhandItem(), ItemDisplayContext.GROUND, true, entity);
public static void extractHoldingEntityRenderState(LivingEntity entity, NetherKnightRenderState state, ItemModelResolver resolver) {
resolver.updateForLiving(state.rightHandItem, entity.getItemHeldByArm(HumanoidArm.RIGHT), ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, false, entity);
resolver.updateForLiving(state.leftHandItem, entity.getItemHeldByArm(HumanoidArm.LEFT), ItemDisplayContext.THIRD_PERSON_LEFT_HAND, true, entity);
}

}

0 comments on commit f18e81d

Please sign in to comment.