mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Fixed rendering of disguises in the hud
This commit is contained in:
parent
c50d5535c6
commit
78dd2a93e8
1 changed files with 10 additions and 5 deletions
|
@ -21,6 +21,7 @@ import net.minecraft.client.gui.DrawableHelper;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.entity.EntityDimensions;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -96,20 +97,24 @@ public class UHud extends DrawableHelper {
|
||||||
.map(Disguise::getAppearance)
|
.map(Disguise::getAppearance)
|
||||||
.ifPresent(appearance -> {
|
.ifPresent(appearance -> {
|
||||||
|
|
||||||
float baseHeight = 14;
|
float baseHeight = 20;
|
||||||
float entityHeight = appearance.getDimensions(appearance.getPose()).height;
|
|
||||||
|
EntityDimensions dims = appearance.getDimensions(appearance.getPose());
|
||||||
|
|
||||||
|
float entityHeight = Math.max(dims.height, dims.width);
|
||||||
int scale = (int)(baseHeight / entityHeight);
|
int scale = (int)(baseHeight / entityHeight);
|
||||||
|
|
||||||
int x = scaledWidth / 2 + 67;
|
int x = scaledWidth / 2 + xDirection * 67;
|
||||||
int y = scaledHeight - 25;
|
int y = (int)(scaledHeight - 18 - dims.height/2F);
|
||||||
|
|
||||||
MatrixStack view = RenderSystem.getModelViewStack();
|
MatrixStack view = RenderSystem.getModelViewStack();
|
||||||
|
|
||||||
view.push();
|
view.push();
|
||||||
view.translate(x, y, 0);
|
view.translate(x, y, 0);
|
||||||
view.multiply(new Quaternion(-9, 45, 0, true));
|
view.multiply(new Quaternion(-9, xDirection * 45, 0, true));
|
||||||
InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player);
|
InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player);
|
||||||
view.pop();
|
view.pop();
|
||||||
|
RenderSystem.applyModelViewMatrix();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue