fix block harvest tools

This commit is contained in:
Sen 2025-07-31 14:26:28 +02:00
parent 3bdc5fb4a0
commit 1272f87ea0
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
16 changed files with 173 additions and 119 deletions

View file

@ -598,6 +598,8 @@ public class Client implements IThreadListener {
private int crosshairColorBase = 0xffcfcfcf;
@Variable(name = "crosshair_color_target", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (mit Ziel)")
private int crosshairColorTarget = 0xffffffff;
@Variable(name = "info_overlay", category = CVarCategory.GUI, display = "Informations-Overlay")
private boolean infoOverlay = true;
@Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate")
private float tpsTarget = 20.0f;
@ -1164,6 +1166,44 @@ public class Client implements IThreadListener {
this.player.getHorseJumpPower(), 0x4040ff);
y = this.drawBar(x, y, String.format(Color.ACID + "EXP: " + Color.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40);
}
if(this.infoOverlay && this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) {
String desc = null;
String line1 = null;
String line2 = null;
if(this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) {
State state = this.world.getState(this.pointed.block);
Block block = state.getBlock();
if(block != Blocks.air) {
desc = block.getDisplay();
if(block.getMiningLevel() >= 0)
line2 = "Werkzeug: Spitzhacke Level " + (block.getMiningLevel() + 1);
else if(block.canAxeHarvest())
line2 = "Werkzeug: Axt";
else if(block.canShovelHarvest())
line2 = "Werkzeug: Schaufel";
else if(block.canShearsHarvest())
line2 = "Werkzeug: Schere";
else if(block.canSwordHarvest())
line2 = "Werkzeug: Schwert";
}
}
else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) {
Entity entity = this.pointed.entity;
desc = entity.getName();
if(entity instanceof EntityLiving living) {
line1 = living.formatStats();
}
}
if(desc != null) {
Drawing.drawRectBorder(this.fbX / 2 - 180, 20, 360, 60, 0xff6f6f6f, 0xff000000, 0xffafafaf, 0xff4f4f4f);
Drawing.drawTextCentered(desc, this.fbX / 2, 24, 0xffffffff);
if(line1 != null)
Drawing.drawTextCentered(line1, this.fbX / 2, 80 - 4 - Font.YGLYPH * 2, 0xffffffff);
if(line2 != null)
Drawing.drawTextCentered(line2, this.fbX / 2, 80 - 4 - Font.YGLYPH, 0xffffffff);
}
}
GlState.bindTexture(0);
GlState.setActiveTexture(GL13.GL_TEXTURE0);
@ -1186,18 +1226,19 @@ public class Client implements IThreadListener {
}
}
if(this.pointed != null && this.pointed.block != null) {
State state = this.world.getState(this.pointed.block);
if(state.getBlock() != Blocks.air) {
Item item = state.getBlock().getItem();
if(item != null) {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f);
GL11.glScalef(2.0f, 2.0f, 2.0f);
GlState.enableDepth();
this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0);
}
if(this.infoOverlay) {
Item item = null;
if(this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null)
item = this.world.getState(this.pointed.block).getBlock().getItem();
else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null)
item = this.pointed.entity.getItem();
if(item != null) {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f);
GL11.glScalef(2.0f, 2.0f, 2.0f);
GlState.enableDepth();
this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0);
}
}
@ -1546,34 +1587,12 @@ public class Client implements IThreadListener {
}
Item item = null;
if (this.pointed.type == HitPosition.ObjectType.BLOCK)
{
BlockPos blockpos = this.pointed.block;
Block block = this.world.getState(blockpos).getBlock();
if (block == Blocks.air)
{
return;
}
item = block.getItem();
if (item == null)
{
return;
}
}
else
{
if (this.pointed.type != HitPosition.ObjectType.ENTITY || this.pointed.entity == null || !this.itemCheat)
{
return;
}
item = this.world.getState(this.pointed.block).getBlock().getItem();
else if (this.pointed.type == HitPosition.ObjectType.ENTITY && this.pointed.entity != null && this.itemCheat)
item = this.pointed.entity.getItem();
if(item == null)
return;
}
if(item == null)
return;
InventoryPlayer inventoryplayer = this.player.inventory;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After