1
0
Fork 0

add RUDIMENTARY displays

This commit is contained in:
Sen 2025-07-06 13:20:13 +02:00
parent f6b036b517
commit e18a151f6c
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
31 changed files with 795 additions and 483 deletions

View file

@ -960,32 +960,31 @@ public class Client implements IThreadListener {
public void renderHud() {
this.setupOverlay();
if(this.world != null && this.open == null && this.thirdPersonView == 0 && this.viewEntity != null) {
if(this.drawDebug) {
this.renderWorldDirections((float)this.tick_fraction);
}
else if(this.crosshairSize > 0) {
Drawing.drawRect(this.fb_x / 2 - 1, this.fb_y / 2 - this.crosshairSize, 2, this.crosshairSize * 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
Drawing.drawRect(this.fb_x / 2 - this.crosshairSize, this.fb_y / 2 - 1, this.crosshairSize * 2, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
}
}
if(this.world != null && this.open == null) {
int selected = // this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer() ? 9 : 0,
this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer() ?
((EntityNPC)this.getRenderViewEntity()).inventory.currentItem : -1;
for(int n = 0; n < 9; n++) {
int x = this.fb_x / 2 - 180 + n * 40 + 4;
int y = this.fb_y - 40;
// Drawing.drawRect2Border(x - 1, y - 1, 36, 36, 0xff6f6f6f, selected == n ? 0xffffffff : 0xffafafaf);
Drawing.drawRectBorder(x - 1, y - 1, 36, 36, 0xff6f6f6f, selected == n ? 0xffffffff : 0xff000000, 0xffafafaf, 0xff4f4f4f);
}
if(this.world != null && !(this.open instanceof GuiConsole) && this.player != null && this.viewEntity == this.player) {
if(this.open == null) {
if(this.thirdPersonView == 0) {
if(this.drawDebug) {
this.renderWorldDirections((float)this.tick_fraction);
}
else if(this.crosshairSize > 0) {
Drawing.drawRect(this.fb_x / 2 - 1, this.fb_y / 2 - this.crosshairSize, 2, this.crosshairSize * 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
Drawing.drawRect(this.fb_x / 2 - this.crosshairSize, this.fb_y / 2 - 1, this.crosshairSize * 2, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
}
}
int selected = this.player.inventory.currentItem;
for(int n = 0; n < 9; n++) {
int x = this.fb_x / 2 - 180 + n * 40 + 4;
int y = this.fb_y - 40;
Drawing.drawRectBorder(x - 1, y - 1, 36, 36, 0xff6f6f6f, selected == n ? 0xffffffff : 0xff000000, 0xffafafaf, 0xff4f4f4f);
}
ItemStack itemstack = this.player != null ? this.player.inventory.getCurrentItem() : null;
String current = itemstack != null ? itemstack.getItem().getHotbarText(this.player, itemstack) : "";
if(!current.isEmpty())
Drawing.drawTextUpward(current, this.fb_x / 2, this.fb_y - 60, 0xffffffff);
}
if(this.world != null && !(this.open instanceof GuiConsole)) {
ItemStack itemstack = this.player.inventory.getCurrentItem();
String current = itemstack != null ? itemstack.getItem().getHotbarText(this.player, itemstack) : "";
if(!current.isEmpty())
Drawing.drawTextUpward(current, this.fb_x / 2, this.fb_y - 60, 0xffffffff);
}
int x = this.fb_x / 2;
int y = 0;
Iterator<Entry<Integer, Long>> iter = this.bars.entrySet().iterator();
@ -1011,7 +1010,7 @@ public class Client implements IThreadListener {
}
}
if(this.player != null && (!this.drawDebug || this.open != null)) {
if(!this.drawDebug || this.open != null) {
x = 40;
y = 40;
for(PotionEffect effect : this.player.getEffects()) {
@ -1028,61 +1027,50 @@ public class Client implements IThreadListener {
}
}
if(this.getRenderViewEntity() instanceof EntityLiving) {
EntityLiving entity = (EntityLiving)this.getRenderViewEntity();
int absorb = entity.getAbsorptionAmount();
int armor = entity.getTotalArmorValue();
int stats = 1 + (absorb > 0 ? 1 : 0) + (armor > 0 ? 1 : 0) + (entity.vehicle instanceof EntityLiving ? 1 : 0)
+ (entity instanceof EntityNPC npc && npc.getManaPoints() > 0 ? 1 : 0);
for(Energy energy : Energy.values()) {
if(entity.getEnergy(energy) > 0)
stats += 1;
}
x = this.fb_x - 40 - 250;
y = this.fb_y - 40 - stats * 40;
int hp = entity.getHealth();
int max = entity.getMaxHealth();
y = stats(x, y, TextColor.RED + "Schaden", hp, max, 0xff0000);
if(absorb > 0)
y = stats(x, y, TextColor.YELLOW + "Schadenspuffer", absorb, 1024, 0xffff00);
if(armor > 0)
y = stats(x, y, TextColor.GRAY + "Rüstung", armor, 1024, 0x707070);
if(entity.vehicle instanceof EntityLiving) {
EntityLiving living = (EntityLiving)entity.vehicle;
int vh = living.getHealth();
int vhMax = living.getMaxHealth();
y = stats(x, y, living.getDisplayName() /* + " (Reittier)" */, vh, vhMax, 0xff6060);
}
if(entity instanceof EntityNPC npc && npc.getManaPoints() > 0) {
int mana = npc.getManaPoints();
int maxm = npc.getMaxMana();
y = stats(x, y, TextColor.CYAN + "Mana", mana, maxm, 0x0000ff);
}
for(int z = 0; z < Energy.values().length; z++) {
Energy type = Energy.values()[z];
int energy = entity.getEnergy(type);
if(energy > 0) {
int emax = entity.getEnergyCap(type);
y = stats(x, y, TextColor.LGRAY + type.display, energy, emax, entity.hasEnergyEffect(type) ? type.effect : type.color);
}
EntityNPC entity = this.player;
int absorb = entity.getAbsorptionAmount();
int armor = entity.getTotalArmorValue();
int stats = 1 + (absorb > 0 ? 1 : 0) + (armor > 0 ? 1 : 0) + (entity.vehicle instanceof EntityLiving ? 1 : 0)
+ (entity instanceof EntityNPC npc && npc.getManaPoints() > 0 ? 1 : 0);
for(Energy energy : Energy.values()) {
if(entity.getEnergy(energy) > 0)
stats += 1;
}
x = this.fb_x - 40 - 250;
y = this.fb_y - 40 - stats * 40;
int hp = entity.getHealth();
int max = entity.getMaxHealth();
y = stats(x, y, TextColor.RED + "Schaden", hp, max, 0xff0000);
if(absorb > 0)
y = stats(x, y, TextColor.YELLOW + "Schadenspuffer", absorb, 1024, 0xffff00);
if(armor > 0)
y = stats(x, y, TextColor.GRAY + "Rüstung", armor, 1024, 0x707070);
if(entity.vehicle instanceof EntityLiving) {
EntityLiving living = (EntityLiving)entity.vehicle;
int vh = living.getHealth();
int vhMax = living.getMaxHealth();
y = stats(x, y, living.getDisplayName() /* + " (Reittier)" */, vh, vhMax, 0xff6060);
}
if(entity instanceof EntityNPC npc && npc.getManaPoints() > 0) {
int mana = npc.getManaPoints();
int maxm = npc.getMaxMana();
y = stats(x, y, TextColor.CYAN + "Mana", mana, maxm, 0x0000ff);
}
for(int z = 0; z < Energy.values().length; z++) {
Energy type = Energy.values()[z];
int energy = entity.getEnergy(type);
if(energy > 0) {
int emax = entity.getEnergyCap(type);
y = stats(x, y, TextColor.LGRAY + type.display, energy, emax, entity.hasEnergyEffect(type) ? type.effect : type.color);
}
}
if(this.player != null) {
x = 40;
y = this.fb_y - 40 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40;
if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // {
y = bar(x, y, String.format(TextColor.NEON + "Sprungkraft: " + TextColor.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)),
this.player.getHorseJumpPower(), 0x4040ff);
// }
// else {
y = bar(x, y, String.format(TextColor.ACID + "EXP: " + TextColor.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40);
// }
}
// SKC.pointed(this.pointed != null && this.pointed.type != ObjectType.MISS);
// SKC.crosshair(this.thirdPersonView == 0);
x = 40;
y = this.fb_y - 40 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40;
if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // {
y = bar(x, y, String.format(TextColor.NEON + "Sprungkraft: " + TextColor.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)),
this.player.getHorseJumpPower(), 0x4040ff);
y = bar(x, y, String.format(TextColor.ACID + "EXP: " + TextColor.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40);
}
// gdr.shader = 0;
@ -1098,8 +1086,7 @@ public class Client implements IThreadListener {
GlState.setActiveTexture(GL13.GL_TEXTURE0);
GlState.enableTexture2D();
// GlState.disableDepth();
if(this.open == null && this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer()) {
EntityNPC player = (EntityNPC)this.getRenderViewEntity();
if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) {
GlState.enableRescaleNormal();
GlState.enableBlend();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
@ -1113,7 +1100,7 @@ public class Client implements IThreadListener {
for(int index = 0; index < 9; ++index) {
int xPos = index * 20;
// int yPos = this.fb_y - 40;
ItemStack itemstack = player.inventory.mainInventory[index];
ItemStack itemstack = this.player.inventory.mainInventory[index];
if(itemstack != null) {
GlState.enableDepth();
this.renderItem.renderItemAndEffectIntoGUI(itemstack, xPos, 0);
@ -1135,10 +1122,9 @@ public class Client implements IThreadListener {
// java_check_exc();
GlState.disableDepth();
// SKC.foreground();
if(this.open == null && this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer()) {
EntityNPC player = (EntityNPC)this.getRenderViewEntity();
if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) {
for(int index = 0; index < 9; ++index) {
ItemStack itemstack = player.inventory.mainInventory[index];
ItemStack itemstack = this.player.inventory.mainInventory[index];
if(itemstack != null) {
GuiContainer.renderItemOverlay(itemstack,
this.fb_x / 2 - 180 + 4 + 1 + index * 40, this.fb_y - 40 + 1, null);
@ -1158,9 +1144,19 @@ public class Client implements IThreadListener {
this.drawOverlay(this.chat, this.chatSize, true, -1, this.fb_x, this.fb_y);
}
if(this.drawFps) { // && !(this.open instanceof GuiConsole)
if(this.drawDebug && this.open == null) {
this.renderStats();
this.renderLagometer();
if(this.drawDebug) {
if(this.open == null) {
this.renderStats();
this.renderLagometer();
}
else {
Drawing.drawText(String.format("%s%.2f" + TextColor.RESET + " %s [%s" + TextColor.RESET + "], %.3f ms, W %d x %d%s",
this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS",
this.vsync ? TextColor.DGRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"),
(float)PerfSection.getTotal(false) / 1000.0f, this.fb_raw_x, this.fb_raw_y,
this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : ""),
0, 0, 0xffffffff);
}
}
else {
Drawing.drawText(String.format("%s%.2f", framecode(), this.framerate), 0, 0, 0xffffffff);