Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
Display armour value in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
percivalalb committed May 8, 2021
1 parent 38fae1b commit a52e665
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,10 @@ public void render(DogEntity entityIn, float entityYaw, float partialTicks, Matr
double d0 = this.renderManager.squareDistanceTo(entityIn);
if (d0 <= 64 * 64) {
String tip = entityIn.getMode().getTip();
double armorValue = 0.0D;
if (entityIn.getAttribute(Attributes.ARMOR) != null) {
armorValue = entityIn.getAttribute(Attributes.ARMOR).getValue();
}
String label = String.format(ConfigValues.DOG_GENDER ? "%s(%d)%s(%d)" : "%s(%d)(%d)",
String label = String.format(ConfigValues.DOG_GENDER ? "%s(%d)%s" : "%s(%d)",
new TranslationTextComponent(tip).getString(),
MathHelper.ceil(entityIn.getDogHunger()),
new TranslationTextComponent(entityIn.getGender().getUnlocalisedTip()).getString(),
(int) armorValue);
new TranslationTextComponent(entityIn.getGender().getUnlocalisedTip()).getString());

RenderUtil.renderLabelWithScale(entityIn, this, label, matrixStackIn, bufferIn, packedLightIn, 0.01F, 0.12F);

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/doggytalents/client/screen/DogInfoScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks
String health = Util.format1DP(this.dog.getHealth());
String healthMax = Util.format1DP(this.dog.getMaxHealth());
String speedValue = Util.format2DP(this.dog.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
String armorValue = Util.format2DP(this.dog.getAttribute(Attributes.ARMOR).getValue());
String ageValue = Util.format2DP(this.dog.getGrowingAge());
String ageRel = I18n.format(this.dog.isChild() ? "doggui.age.baby" : "doggui.age.adult");

Expand All @@ -297,8 +298,9 @@ public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks
this.font.drawString(stack, I18n.format("doggui.speed") + " " + speedValue, this.width - 160, topY - 100, 0xFFFFFF);
this.font.drawString(stack, I18n.format("doggui.owner") + " " + tamedString, this.width - 160, topY - 90, 0xFFFFFF);
this.font.drawString(stack, I18n.format("doggui.age") + " " + ageString, this.width - 160, topY - 80, 0xFFFFFF);
this.font.drawString(stack, I18n.format("doggui.armor") + " " + armorValue, this.width - 160, topY - 70, 0xFFFFFF);
if (ConfigValues.DOG_GENDER) {
this.font.drawString(stack, I18n.format("doggui.gender") + " "+ I18n.format(this.dog.getGender().getUnlocalisedName()), this.width - 160, topY - 70, 0xFFFFFF);
this.font.drawString(stack, I18n.format("doggui.gender") + " "+ I18n.format(this.dog.getGender().getUnlocalisedName()), this.width - 160, topY - 60, 0xFFFFFF);
}

this.font.drawString(stack, I18n.format("doggui.newname"), topX - 100, topY + 38, 4210752);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/doggytalents/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"doggui.owner": "Owner:",
"doggui.gender": "Gender:",
"doggui.age": "Age:",
"doggui.armor": "Armour:",
"doggui.owner.you": "You",
"doggui.age.baby": "Puppy",
"doggui.age.adult": "Adult",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/doggytalents/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"doggui.owner": "Owner:",
"doggui.gender": "Gender:",
"doggui.age": "Age:",
"doggui.armor": "Armor:",
"doggui.owner.you": "You",
"doggui.age.baby": "Puppy",
"doggui.age.adult": "Adult",
Expand Down

0 comments on commit a52e665

Please sign in to comment.