Fixed bracelet rendering offset on armor stands

This commit is contained in:
Sollace 2022-01-04 18:14:34 +02:00
parent c6bb37546d
commit eaa3c8a2a5

View file

@ -59,11 +59,15 @@ public class BraceletFeatureRenderer<E extends LivingEntity> implements Accessor
BraceletModel model = alex ? alexModel : steveModel; BraceletModel model = alex ? alexModel : steveModel;
boolean isLeft = entity.getMainArm() == Arm.LEFT;
int sigma = isLeft ? 1 : -1;
if (entity instanceof ArmorStandEntity) { if (entity instanceof ArmorStandEntity) {
ModelPart arm = entity.getMainArm() == Arm.LEFT ? context.getModel().leftArm : context.getModel().rightArm; ModelPart arm = isLeft ? context.getModel().leftArm : context.getModel().rightArm;
arm.visible = true; arm.visible = true;
VertexConsumer consumer = renderContext.getBuffer(context.getModel().getLayer(context.getTexture(entity))); VertexConsumer consumer = renderContext.getBuffer(context.getModel().getLayer(context.getTexture(entity)));
arm.render(stack, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); arm.render(stack, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
arm.pivotX += sigma;
} }
boolean glowing = ((GlowableItem)item.getItem()).isGlowing(item); boolean glowing = ((GlowableItem)item.getItem()).isGlowing(item);
@ -73,6 +77,11 @@ public class BraceletFeatureRenderer<E extends LivingEntity> implements Accessor
model.setAngles(context.getModel()); model.setAngles(context.getModel());
model.setVisible(entity.getMainArm()); model.setVisible(entity.getMainArm());
model.render(stack, consumer, glowing ? 0x0F00F0 : lightUv, OverlayTexture.DEFAULT_UV, Color.r(j), Color.g(j), Color.b(j), 1); model.render(stack, consumer, glowing ? 0x0F00F0 : lightUv, OverlayTexture.DEFAULT_UV, Color.r(j), Color.g(j), Color.b(j), 1);
if (entity instanceof ArmorStandEntity) {
ModelPart arm = isLeft ? context.getModel().leftArm : context.getModel().rightArm;
arm.pivotX -= sigma;
}
} }
} }