1
0
Fork 0

fix block hardness + sounds

This commit is contained in:
Sen 2025-09-10 14:13:10 +02:00
parent 9f9a2e9399
commit 2504f24b7b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
20 changed files with 70 additions and 54 deletions

View file

@ -901,7 +901,7 @@ public abstract class GuiContainer extends Gui
for(Iterator<ItemStack> iter = ITEM_LIST.iterator(); iter.hasNext();) {
ItemStack stack = iter.next();
for(String line : this.getTooltip(stack)) {
if(line.toLowerCase().contains(this.cheatLast.toLowerCase())) {
if(Color.stripCodes(line).toLowerCase().contains(this.cheatLast.toLowerCase())) {
stack = null;
break;
}

View file

@ -1491,6 +1491,12 @@ public class ClientPlayer implements IClientPlayer
this.gm.effectRenderer.destroyBlock(blockPosIn, state);
break;
case 2003:
State state1 = BlockRegistry.byId(data);
if(state1 != null)
this.gm.effectRenderer.destroyBlock(blockPosIn, state1);
break;
case 2002:
double d13 = (double)blockPosIn.getX();
double d14 = (double)blockPosIn.getY();

View file

@ -8,14 +8,12 @@ import common.entity.npc.EntityNPC;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.init.EntityRegistry;
import common.init.SoundEvent;
import common.item.ItemControl;
import common.item.ItemStack;
import common.packet.CPacketAction;
import common.packet.CPacketBreak;
import common.packet.CPacketClick;
import common.packet.CPacketPlace;
import common.sound.PositionedSound;
import common.util.LocalPos;
import common.util.Facing;
import common.util.Vec3;
@ -29,7 +27,6 @@ public class PlayerController {
private LocalPos position = new LocalPos(-1, -World.MAX_SIZE_Y - 1, -1);
private ItemStack stack;
private float damage;
private float stepCounter;
private int delay;
private boolean hitting;
private int lastSelected;
@ -109,7 +106,6 @@ public class PlayerController {
this.position = pos;
this.stack = this.gm.player.getHeldItem();
this.damage = 0.0F;
this.stepCounter = 0.0F;
}
}
@ -148,19 +144,11 @@ public class PlayerController {
else {
this.damage += block.getHardness(this.gm.player, this.gm.player.worldObj, pos);
if(this.stepCounter % 4.0F == 0.0F) {
this.gm.getSoundManager().playSound(new PositionedSound(SoundEvent.BLOCK_DAMAGE, 0.05F,
(float)pos.getX() + 0.5F, (float)pos.getY() + 0.5F, (float)pos.getZ() + 0.5F));
}
++this.stepCounter;
if(this.damage >= 1.0F) {
this.hitting = false;
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.STOP_DESTROY_BLOCK, pos, face));
this.destroyBlock(pos, face);
this.damage = 0.0F;
this.stepCounter = 0.0F;
this.delay = 5;
}
return true;