use of cc.hyperium.mods.levelhead.display.AboveHeadDisplay in project Hyperium by HyperiumClient.
the class AboveHeadRenderer method render.
@InvokeEvent
public void render(RenderPlayerEvent event) {
if (levelhead == null || levelhead.getDisplayManager() == null || levelhead.getDisplayManager().getMasterConfig() == null || !levelhead.getDisplayManager().getMasterConfig().isEnabled()) {
return;
}
EntityPlayer player = event.getEntity();
int o = 0;
for (AboveHeadDisplay display : levelhead.getDisplayManager().getAboveHead()) {
int index = display.getIndex();
int extraHead = levelhead.getLevelheadPurchaseStates().getExtraHead();
if (index > extraHead || !display.getConfig().isEnabled())
continue;
LevelheadTag levelheadTag = display.getCache().get(player.getUniqueID());
if (display.loadOrRender(player) && levelheadTag != null && !(levelheadTag instanceof NullLevelheadTag)) {
if ((event.getEntity().getUniqueID().equals(Levelhead.getInstance().userUuid) && !display.getConfig().isShowSelf() || !Hyperium.INSTANCE.getHandlers().getHypixelDetector().isHypixel())) {
continue;
}
if (player.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) < 64 * 64) {
double offset = 0.3;
Scoreboard scoreboard = player.getWorldScoreboard();
ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(2);
if (objective != null && event.getEntity().getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) < 10 * 10) {
offset *= 2;
}
if (player.getUniqueID().equals(levelhead.userUuid) && !Settings.SHOW_OWN_NAME)
offset -= .3;
if (Hyperium.INSTANCE.getCosmetics().getDeadmau5Cosmetic().isPurchasedBy(event.getEntity().getUniqueID())) {
HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
if (packageIfReady != null) {
AbstractHyperiumPurchase purchase = packageIfReady.getPurchase(EnumPurchaseType.DEADMAU5_COSMETIC);
if (purchase != null) {
if (event.getEntity().getUniqueID() != Minecraft.getMinecraft().thePlayer.getUniqueID()) {
if (((EarsCosmetic) purchase).isEnabled()) {
offset += .3;
}
} else if (Settings.EARS_STATE.equalsIgnoreCase("on")) {
offset += .2;
}
}
}
}
offset += levelhead.getDisplayManager().getMasterConfig().getOffset();
renderName(event, levelheadTag, player, event.getX(), event.getY() + offset + o * .3D, event.getZ());
}
}
o++;
}
}
use of cc.hyperium.mods.levelhead.display.AboveHeadDisplay in project Hyperium by HyperiumClient.
the class Levelhead method refreshPurchaseStates.
public synchronized void refreshPurchaseStates() {
purchaseStatus = new LevelheadJsonHolder(rawWithAgent("https://api.sk1er.club/levelhead_purchase_status/" + Minecraft.getMinecraft().getSession().getProfile().getId().toString()));
levelheadPurchaseStates.setChat(purchaseStatus.optBoolean("chat"));
levelheadPurchaseStates.setTab(purchaseStatus.optBoolean("tab"));
levelheadPurchaseStates.setExtraHead(purchaseStatus.optInt("head"));
DisplayManager displayManager = this.displayManager;
while (displayManager.getAboveHead().size() <= levelheadPurchaseStates.getExtraHead()) {
displayManager.getAboveHead().add(new AboveHeadDisplay(new DisplayConfig()));
}
displayManager.adjustIndexes();
}
Aggregations