Add hatchet functionality

This commit is contained in:
kuroppoi 2024-02-20 04:05:27 +01:00
parent 5928ec5c98
commit e7c48133cc
2 changed files with 18 additions and 0 deletions

View file

@ -28,6 +28,7 @@ public enum Action {
REFILL(new RefillConsumable()),
SKILL(new SkillConsumable()),
SKILL_RESET(new SkillResetConsumable()),
SMASH,
STEALTH(new StealthConsumable()),
TELEPORT(new TeleportConsumable()),

View file

@ -95,6 +95,23 @@ public class BlockMineRequest extends PlayerRequest {
return;
}
// Apply decay if block is being mined with a hatchet
if(item.getMod() == ModType.DECAY && player.getHeldItem().getAction() == Action.SMASH) {
int nextMod = Math.min(4, block.getMod(layer) + 1);
zone.updateBlock(x, y, layer, item, nextMod);
// Send inventory message for v3 players
if(player.isV3()) {
Item decayItem = item.getDecayInventoryItem();
if(!decayItem.isAir()) {
player.sendDelayedMessage(new InventoryMessage(player.getInventory().getClientConfig(decayItem)));
}
}
return;
}
if(metaBlock != null) {
Map<String, Object> metadata = metaBlock.getMetadata();