1
0
Fork 0

add block damage to info overlay

This commit is contained in:
Sen 2025-08-22 19:45:48 +02:00
parent ae0b11272d
commit 753f591898
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
2 changed files with 8 additions and 0 deletions

View file

@ -1202,6 +1202,10 @@ public class Client implements IThreadListener {
boolean toolReq = block.getMaterial().isToolRequired(); boolean toolReq = block.getMaterial().isToolRequired();
boolean harvestable = this.player.canHarvestBlock(block); boolean harvestable = this.player.canHarvestBlock(block);
line2 = Color.BLUE + "Werkzeug" + Color.DARK_GRAY + ": " + (block.getMiningTool() != null ? (toolReq ? (harvestable ? Color.GREEN : Color.RED) : Color.LIGHT_GRAY) + block.getMiningTool().getDisplay() + (block.getMiningTool().isLevelled() ? (toolReq ? (harvestable ? Color.ORK : Color.CRIMSON) : Color.DARK_GRAY) + " Level " + (toolReq ? (harvestable ? Color.DARK_GREEN : Color.DARK_RED) : Color.GRAY) + (block.getMiningLevel() + 1) : "") : Color.GRAY + "Keins"); line2 = Color.BLUE + "Werkzeug" + Color.DARK_GRAY + ": " + (block.getMiningTool() != null ? (toolReq ? (harvestable ? Color.GREEN : Color.RED) : Color.LIGHT_GRAY) + block.getMiningTool().getDisplay() + (block.getMiningTool().isLevelled() ? (toolReq ? (harvestable ? Color.ORK : Color.CRIMSON) : Color.DARK_GRAY) + " Level " + (toolReq ? (harvestable ? Color.DARK_GREEN : Color.DARK_RED) : Color.GRAY) + (block.getMiningLevel() + 1) : "") : Color.GRAY + "Keins");
if(this.controller.isHittingBlock()) {
bar = 1.0f - this.controller.getDamage(pos);
color = (int)(bar * 255.0f) << 8 | (int)((1.0f - bar) * 255.0f) << 16;
}
} }
} }
else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) { else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) {

View file

@ -324,4 +324,8 @@ public class PlayerController {
public void resetUseCooldown() { public void resetUseCooldown() {
this.itemUseCooldown = 0; this.itemUseCooldown = 0;
} }
public float getDamage(BlockPos pos) {
return this.hitting && pos.equals(this.position) ? this.damage : 0.0f;
}
} }