mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Fixed magic not rendering for items held by other entities
This commit is contained in:
parent
3322e7eaff
commit
509f6477f2
2 changed files with 24 additions and 19 deletions
|
@ -37,32 +37,36 @@ public class LevitatingItemRenderer {
|
|||
*/
|
||||
public void renderItem(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformationMode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) {
|
||||
|
||||
if (entity instanceof PlayerEntity && (mode.isFirstPerson() || mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND || mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND)) {
|
||||
if (mode.isFirstPerson()
|
||||
|| mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND
|
||||
|| mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND
|
||||
) {
|
||||
Pony.getManager().getPony(entity).ifPresentOrElse(pony -> {
|
||||
matrix.push();
|
||||
|
||||
Pony pony = Pony.getManager().getPony((PlayerEntity)entity);
|
||||
boolean doMagic = PonyConfig.getInstance().fpsmagic.get() && pony.hasMagic();
|
||||
|
||||
matrix.push();
|
||||
if (doMagic && mode.isFirstPerson()) {
|
||||
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
||||
}
|
||||
|
||||
boolean doMagic = PonyConfig.getInstance().fpsmagic.get() && pony.hasMagic();
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
|
||||
if (doMagic && mode.isFirstPerson()) {
|
||||
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
||||
}
|
||||
if (doMagic) {
|
||||
VertexConsumerProvider interceptedContext = getProvider(pony, renderContext);
|
||||
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
matrix.scale(1.1F, 1.1F, 1.1F);
|
||||
matrix.translate(0.015F, 0.01F, 0.01F);
|
||||
|
||||
if (doMagic) {
|
||||
VertexConsumerProvider interceptedContext = getProvider(pony, renderContext);
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
matrix.translate(-0.03F, -0.02F, -0.02F);
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
}
|
||||
|
||||
matrix.scale(1.1F, 1.1F, 1.1F);
|
||||
matrix.translate(0.015F, 0.01F, 0.01F);
|
||||
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
matrix.translate(-0.03F, -0.02F, -0.02F);
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
}
|
||||
|
||||
matrix.pop();
|
||||
matrix.pop();
|
||||
}, () -> {
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
});
|
||||
} else {
|
||||
itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
|
|||
|
||||
return main ? entity.getMainHandStack() : entity.getOffHandStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue