Fix model offsets when scaled

This commit is contained in:
Sollace 2024-10-05 00:00:00 +01:00
parent 6ffe1f5e58
commit 3b6ad3d094
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 2 additions and 6 deletions

View file

@ -128,8 +128,6 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
String count = value > 99 ? "99+" : Math.round(value) == value ? (int)value + "" : ((Math.round(value * 10) / 10F) + ""); String count = value > 99 ? "99+" : Math.round(value) == value ? (int)value + "" : ((Math.round(value * 10) / 10F) + "");
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers(); VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers();
// TODO: Before 1.21 was using tessellator's buffer but we can't get it without calling begin()
//VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
textRenderer.draw(count, 0, 0, 16777215, true, matrices.peek().getPositionMatrix(), immediate, TextLayerType.SEE_THROUGH, 0, 15728880); textRenderer.draw(count, 0, 0, 16777215, true, matrices.peek().getPositionMatrix(), immediate, TextLayerType.SEE_THROUGH, 0, 15728880);
immediate.draw(); immediate.draw();
matrices.pop(); matrices.pop();

View file

@ -43,8 +43,7 @@ public class FriendlyCreeperEntityRenderer extends MobEntityRenderer<FriendlyCre
protected void setupTransforms(FriendlyCreeperEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta, float scale) { protected void setupTransforms(FriendlyCreeperEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta, float scale) {
super.setupTransforms(entity, matrices, animationProgress, bodyYaw, tickDelta, scale); super.setupTransforms(entity, matrices, animationProgress, bodyYaw, tickDelta, scale);
if (entity.isSitting()) { if (entity.isSitting()) {
// TODO: Check if creepers are offset correctly matrices.translate(0, -0.25, 0);
matrices.translate(0, -0.25 * scale, 0);
} }
} }

View file

@ -42,8 +42,7 @@ public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntit
super.setupTransforms(entity, matrices, animationProgress, bodyYaw + 90, tickDelta, scale); super.setupTransforms(entity, matrices, animationProgress, bodyYaw + 90, tickDelta, scale);
if (entity.isOpen()) { if (entity.isOpen()) {
// TODO: Check that this is correct for extreme scales matrices.translate(-1.25F, -0.35F, 0);
matrices.translate(-1.25F * scale, -0.35F * scale, 0);
float floatPosition = MathHelper.sin((animationProgress + entity.getId()) / 20) * 0.04F; float floatPosition = MathHelper.sin((animationProgress + entity.getId()) / 20) * 0.04F;