use of net.minecraft.scoreboard.Team in project Almura by AlmuraDev.
the class MixinRenderPlayer method canRenderName.
/**
* @author Zidane
* @reason To have titles render under the nameplate
*/
/*
@Overwrite
protected void renderEntityName(AbstractClientPlayer entityIn, double x, double y, double z, String name, double distanceSq) {
if (distanceSq < 100.0D) {
// Draw bottom-up
Scoreboard scoreboard = entityIn.getWorldScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);
if (scoreobjective != null) {
Score score = scoreboard.getOrCreateScore(entityIn.getName(), scoreobjective);
this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
y += (double) ((float) this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F);
}
// Nickname
// Title
// Scoreboard
final String title = manager.getTitle(entityIn.getUniqueID());
if (title != null) {
this.renderLivingLabel(entityIn, title, x, y, z, 128);
y += (double) ((float) this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F);
}
}
super.renderEntityName(entityIn, x, y, z, name, distanceSq);
} */
/**
* @author Dockter
* @reason Helps display name and title when in 3rd person view.
*/
@Override
protected boolean canRenderName(AbstractClientPlayer entity) {
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
boolean flag = !entity.isInvisibleToPlayer(entityplayersp);
Team team = entity.getTeam();
Team team1 = entityplayersp.getTeam();
if (team != null) {
Team.EnumVisible team$enumvisible = team.getNameTagVisibility();
switch(team$enumvisible) {
case ALWAYS:
return flag;
case NEVER:
return false;
case HIDE_FOR_OTHER_TEAMS:
return team1 == null ? flag : team.isSameTeam(team1) && (team.getSeeFriendlyInvisiblesEnabled() || flag);
case HIDE_FOR_OWN_TEAM:
return team1 == null ? flag : !team.isSameTeam(team1) && flag;
default:
return true;
}
}
return Minecraft.isGuiEnabled() && flag && !entity.isBeingRidden();
}
Aggregations