#8 implement grade as number and gradient #9
3 changed files with 22 additions and 7 deletions
|
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
loader_version=0.11.3
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.1.0
|
||||
mod_version = 1.1.1
|
||||
maven_group = net.saltymc.eaa
|
||||
archives_base_name = EAA_MOD
|
||||
|
||||
|
|
|
@ -163,12 +163,21 @@ public final class CustomPlayerListHud {
|
|||
/*
|
||||
* PLAYER TAG
|
||||
*/
|
||||
int offset_tag_playername = aa;
|
||||
TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString());
|
||||
mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor());
|
||||
offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1;
|
||||
mc.textRenderer.drawWithShadow(stack,"|", (float) offset_tag_playername, (float) ab, playerTAG.getGradeColor());
|
||||
offset_tag_playername += mc.textRenderer.getWidth("|") + 2;
|
||||
int offset_tag_playername = aa; // safe current x offset ->
|
||||
TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); // retrieve Tag object
|
||||
mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor()); // draw tag name
|
||||
|
||||
offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1; // add tag name length to offset
|
||||
|
||||
// current offset plus amount to center grade text
|
||||
float tmp_x = offset_tag_playername
|
||||
+ ((mc.textRenderer.getWidth("10") - mc.textRenderer.getWidth(playerTAG.getGrade() < 1 ? "|" : playerTAG.getGrade() +""))
|
||||
/ 2.0f);
|
||||
mc.textRenderer.drawWithShadow(stack,
|
||||
playerTAG.getGrade() < 1 ? "|" : playerTAG.getGrade() +"", // if not given draw a pipe
|
||||
(float) tmp_x, (float) ab, playerTAG.getGradeColor());
|
||||
|
||||
offset_tag_playername += mc.textRenderer.getWidth("10") + 2; // add offset of largest character
|
||||
|
||||
|
||||
Text playerName = hud.getPlayerName(player);
|
||||
|
|
|
@ -5,10 +5,12 @@ import net.saltymc.eaa.util.database.DB_Tag;
|
|||
import static net.saltymc.eaa.custom.ping.PingColors.computeOffset;
|
||||
|
||||
public class TagDTO {
|
||||
final int grade;
|
||||
final int gradeColor;
|
||||
final DB_Tag.Type type;
|
||||
|
||||
public TagDTO(int grade, DB_Tag.Type type) {
|
||||
this.grade = grade;
|
||||
this.gradeColor = calcGradient(grade, type);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -30,4 +32,8 @@ public class TagDTO {
|
|||
type.getColor(),
|
||||
computeOffset(0, 10, grade));
|
||||
}
|
||||
|
||||
public int getGrade(){
|
||||
return grade;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue