Fixed bubble spell offset from entity center. Fixes #457

This commit is contained in:
Sollace 2024-09-18 17:33:13 +01:00
parent 8c560e3ff3
commit 7b5a7682c4
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -19,19 +19,22 @@ public class BubbleSpellRenderer extends SpellRenderer<BubbleSpell> {
super.render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch);
matrices.push();
double height = caster.asEntity().getEyeY() - caster.getOriginVector().y;
matrices.translate(0, height * 0.5F, 0);
double height = caster.asEntity().getEyeY() - caster.getOriginVector().getY();
float radius = spell.getRadius(tickDelta) * 0.7F;
VertexConsumer buffer = vertices.getBuffer(RenderLayers.getMagicNoColor());
float radius = spell.getRadius(tickDelta) * 1.5F;
matrices.translate(0, radius * 0.5F + height, 0);
VertexConsumer buffer = vertices.getBuffer(RenderLayers.getMagicShield());
Entity cameraEntity = MinecraftClient.getInstance().getCameraEntity();
matrices.push();
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(-45));
matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(45 + cameraEntity.getYaw(tickDelta)));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(-cameraEntity.getPitch(tickDelta)));
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(cameraEntity.getYaw(tickDelta) - 25));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-cameraEntity.getPitch(tickDelta)));
new SphereModel(40, 40, DrawableUtil.PI * 0.25F).render(matrices, buffer, light, 0, radius - 0.1F, 0.9F, 0.9F, 1, 0.3F);
matrices.pop();