dunno
This commit is contained in:
parent
c048d26b65
commit
6ad8a7a484
|
@ -10,7 +10,6 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
|
||||||
public class OverlayRenderer {
|
public class OverlayRenderer {
|
||||||
public static void renderOverlay(DrawContext context, float deltaTick) {
|
public static void renderOverlay(DrawContext context, float deltaTick) {
|
||||||
MinecraftClient Instance = MinecraftClient.getInstance();
|
MinecraftClient Instance = MinecraftClient.getInstance();
|
||||||
|
@ -21,76 +20,174 @@ public class OverlayRenderer {
|
||||||
|
|
||||||
ItemStack mainHandItem = player.getMainHandStack();
|
ItemStack mainHandItem = player.getMainHandStack();
|
||||||
|
|
||||||
double ItemCombatXp = 0;
|
double ItemExp = 0;
|
||||||
int ChampionExp = 0;
|
int ItemExpRequired = 0;
|
||||||
String ChampionLevel = "null";
|
String EnchantLevel = "null";
|
||||||
String ChampionPercent = "0%";
|
String EnchantPercent = "0%";
|
||||||
int ChampionExpCumu = 0;
|
int ItemExpPrevious = 0;
|
||||||
|
String EnchantName = "";
|
||||||
|
|
||||||
|
if (mainHandItem == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (mainHandItem != null) {
|
|
||||||
NbtCompound tags = mainHandItem.getNbt();
|
NbtCompound tags = mainHandItem.getNbt();
|
||||||
if (tags == null || !tags.contains("ExtraAttributes", 10))
|
if (tags == null || !tags.contains("ExtraAttributes", 10))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NbtCompound extraAttributes = tags.getCompound("ExtraAttributes");
|
NbtCompound extraAttributes = tags.getCompound("ExtraAttributes");
|
||||||
if (extraAttributes == null || !extraAttributes.contains("champion_combat_xp"))
|
if (extraAttributes == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemCombatXp = extraAttributes.getDouble("champion_combat_xp");
|
if (extraAttributes.contains("champion_combat_xp")) {
|
||||||
|
EnchantName = "Champion";
|
||||||
|
ItemExp = extraAttributes.getDouble("champion_combat_xp");
|
||||||
|
|
||||||
if (ItemCombatXp < 50000) {
|
if (ItemExp < 50000) {
|
||||||
ChampionExp = 50000;
|
ItemExpRequired = 50000;
|
||||||
ChampionLevel = "I";
|
EnchantLevel = "I";
|
||||||
} else if (ItemCombatXp < 100000) {
|
} else if (ItemExp < 100000) {
|
||||||
ChampionExp = 100000;
|
ItemExpRequired = 100000;
|
||||||
ChampionExpCumu = 50000;
|
ItemExpPrevious = 50000;
|
||||||
ChampionLevel = "II";
|
EnchantLevel = "II";
|
||||||
} else if (ItemCombatXp < 250000) {
|
} else if (ItemExp < 250000) {
|
||||||
ChampionExp = 250000;
|
ItemExpRequired = 250000;
|
||||||
ChampionExpCumu = 100000;
|
ItemExpPrevious = 100000;
|
||||||
ChampionLevel = "III";
|
EnchantLevel = "III";
|
||||||
} else if (ItemCombatXp < 500000) {
|
} else if (ItemExp < 500000) {
|
||||||
ChampionExp = 500000;
|
ItemExpRequired = 500000;
|
||||||
ChampionExpCumu = 250000;
|
ItemExpPrevious = 250000;
|
||||||
ChampionLevel = "IV";
|
EnchantLevel = "IV";
|
||||||
} else if (ItemCombatXp < 1000000) {
|
} else if (ItemExp < 1000000) {
|
||||||
ChampionExp = 1000000;
|
ItemExpRequired = 1000000;
|
||||||
ChampionExpCumu = 500000;
|
ItemExpPrevious = 500000;
|
||||||
ChampionLevel = "V";
|
EnchantLevel = "V";
|
||||||
} else if (ItemCombatXp < 1500000) {
|
} else if (ItemExp < 1500000) {
|
||||||
ChampionExp = 1500000;
|
ItemExpRequired = 1500000;
|
||||||
ChampionExpCumu = 1000000;
|
ItemExpPrevious = 1000000;
|
||||||
ChampionLevel = "VI";
|
EnchantLevel = "VI";
|
||||||
} else if (ItemCombatXp < 2000000) {
|
} else if (ItemExp < 2000000) {
|
||||||
ChampionExp = 2000000;
|
ItemExpRequired = 2000000;
|
||||||
ChampionExpCumu = 1500000;
|
ItemExpPrevious = 1500000;
|
||||||
ChampionLevel = "VII";
|
EnchantLevel = "VII";
|
||||||
} else if (ItemCombatXp < 2500000) {
|
} else if (ItemExp < 2500000) {
|
||||||
ChampionExp = 2500000;
|
ItemExpRequired = 2500000;
|
||||||
ChampionExpCumu = 2000000;
|
ItemExpPrevious = 2000000;
|
||||||
ChampionLevel = "VIII";
|
EnchantLevel = "VIII";
|
||||||
} else if (ItemCombatXp < 3000000) {
|
} else if (ItemExp < 3000000) {
|
||||||
ChampionExp = 3000000;
|
ItemExpRequired = 3000000;
|
||||||
ChampionExpCumu = 2500000;
|
ItemExpPrevious = 2500000;
|
||||||
ChampionLevel = "IX";
|
EnchantLevel = "IX";
|
||||||
} else if (ItemCombatXp > 3000000) {
|
} else if (ItemExp > 3000000) {
|
||||||
ChampionExp = -1;
|
ItemExpRequired = -1;
|
||||||
ChampionExpCumu = 3000000;
|
ItemExpPrevious = 3000000;
|
||||||
ChampionLevel = "X";
|
EnchantLevel = "X";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (extraAttributes.contains("farmed_cultivating")) {
|
||||||
|
EnchantName = "Cultivating";
|
||||||
|
ItemExp = extraAttributes.getDouble("farmed_cultivating");
|
||||||
|
|
||||||
ChampionPercent = new DecimalFormat("##.00")
|
if (ItemExp < 1000) {
|
||||||
.format((ItemCombatXp - ChampionExpCumu) / (ChampionExp - ChampionExpCumu) * 100);
|
ItemExpRequired = 1000;
|
||||||
|
EnchantLevel = "I";
|
||||||
|
} else if (ItemExp < 5000) {
|
||||||
|
ItemExpRequired = 5000;
|
||||||
|
ItemExpPrevious = 1000;
|
||||||
|
EnchantLevel = "II";
|
||||||
|
} else if (ItemExp < 25000) {
|
||||||
|
ItemExpRequired = 25000;
|
||||||
|
ItemExpPrevious = 5000;
|
||||||
|
EnchantLevel = "III";
|
||||||
|
} else if (ItemExp < 100000) {
|
||||||
|
ItemExpRequired = 100000;
|
||||||
|
ItemExpPrevious = 25000;
|
||||||
|
EnchantLevel = "IV";
|
||||||
|
} else if (ItemExp < 300000) {
|
||||||
|
ItemExpRequired = 300000;
|
||||||
|
ItemExpPrevious = 100000;
|
||||||
|
EnchantLevel = "V";
|
||||||
|
} else if (ItemExp < 1500000) {
|
||||||
|
ItemExpRequired = 1500000;
|
||||||
|
ItemExpPrevious = 300000;
|
||||||
|
EnchantLevel = "VI";
|
||||||
|
} else if (ItemExp < 5000000) {
|
||||||
|
ItemExpRequired = 5000000;
|
||||||
|
ItemExpPrevious = 1500000;
|
||||||
|
EnchantLevel = "VII";
|
||||||
|
} else if (ItemExp < 20000000) {
|
||||||
|
ItemExpRequired = 20000000;
|
||||||
|
ItemExpPrevious = 5000000;
|
||||||
|
EnchantLevel = "VIII";
|
||||||
|
} else if (ItemExp < 100000000) {
|
||||||
|
ItemExpRequired = 100000000;
|
||||||
|
ItemExpPrevious = 20000000;
|
||||||
|
EnchantLevel = "IX";
|
||||||
|
} else if (ItemExp > 100000000) {
|
||||||
|
ItemExpRequired = -1;
|
||||||
|
ItemExpPrevious = 100000000;
|
||||||
|
EnchantLevel = "X";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (extraAttributes.contains("expertise_kills")) {
|
||||||
|
EnchantName = "Expertise";
|
||||||
|
ItemExp = extraAttributes.getDouble("expertise_kills");
|
||||||
|
|
||||||
|
if (ItemExp < 50) {
|
||||||
|
ItemExpRequired = 50;
|
||||||
|
EnchantLevel = "I";
|
||||||
|
} else if (ItemExp < 100) {
|
||||||
|
ItemExpRequired = 100;
|
||||||
|
ItemExpPrevious = 50;
|
||||||
|
EnchantLevel = "II";
|
||||||
|
} else if (ItemExp < 250) {
|
||||||
|
ItemExpRequired = 250;
|
||||||
|
ItemExpPrevious = 100;
|
||||||
|
EnchantLevel = "III";
|
||||||
|
} else if (ItemExp < 500) {
|
||||||
|
ItemExpRequired = 500;
|
||||||
|
ItemExpPrevious = 250;
|
||||||
|
EnchantLevel = "IV";
|
||||||
|
} else if (ItemExp < 1000) {
|
||||||
|
ItemExpRequired = 1000;
|
||||||
|
ItemExpPrevious = 500;
|
||||||
|
EnchantLevel = "V";
|
||||||
|
} else if (ItemExp < 2500) {
|
||||||
|
ItemExpRequired = 2500;
|
||||||
|
ItemExpPrevious = 1000;
|
||||||
|
EnchantLevel = "VI";
|
||||||
|
} else if (ItemExp < 5500) {
|
||||||
|
ItemExpRequired = 5500;
|
||||||
|
ItemExpPrevious = 2500;
|
||||||
|
EnchantLevel = "VII";
|
||||||
|
} else if (ItemExp < 10000) {
|
||||||
|
ItemExpRequired = 10000;
|
||||||
|
ItemExpPrevious = 5500;
|
||||||
|
EnchantLevel = "VIII";
|
||||||
|
} else if (ItemExp < 15000) {
|
||||||
|
ItemExpRequired = 15000;
|
||||||
|
ItemExpPrevious = 10000;
|
||||||
|
EnchantLevel = "IX";
|
||||||
|
} else if (ItemExp > 15000) {
|
||||||
|
ItemExpRequired = -1;
|
||||||
|
ItemExpPrevious = 15000;
|
||||||
|
EnchantLevel = "X";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*else {
|
||||||
|
System.out.println(extraAttributes);
|
||||||
|
}*/
|
||||||
|
|
||||||
// show hud
|
// show hud
|
||||||
if(ItemCombatXp > 0) {
|
if(ItemExp > 0) {
|
||||||
|
EnchantPercent = new DecimalFormat("##.00")
|
||||||
|
.format((ItemExp - ItemExpPrevious) / (ItemExpRequired - ItemExpPrevious) * 100);
|
||||||
|
|
||||||
NumberFormat format = NumberFormat.getIntegerInstance();
|
NumberFormat format = NumberFormat.getIntegerInstance();
|
||||||
|
|
||||||
TextRenderer textRenderer = Instance.textRenderer;
|
TextRenderer textRenderer = Instance.textRenderer;
|
||||||
String text = "Champion " + ChampionLevel + ": "
|
String text = EnchantName + " " + EnchantLevel + ": "
|
||||||
+ format.format(ItemCombatXp) + " / "
|
+ format.format(ItemExp) + " / "
|
||||||
+ (ChampionExp == -1 ? "Maxed" : format.format(ChampionExp) + " (" + ChampionPercent + "%)");
|
+ (ItemExpRequired == -1 ? "Maxed" : format.format(ItemExpRequired) + " (" + EnchantPercent + "%)");
|
||||||
int width = context.getScaledWindowWidth();
|
int width = context.getScaledWindowWidth();
|
||||||
int height = context.getScaledWindowHeight();
|
int height = context.getScaledWindowHeight();
|
||||||
int textWidth = textRenderer.getWidth(text);
|
int textWidth = textRenderer.getWidth(text);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user