mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +01:00
Merge pull request #399 from Bloepiloepi/item-release-fix
Use active hand when updating item state
This commit is contained in:
commit
f967f6ac6a
@ -2,6 +2,7 @@ package net.minestom.server.listener;
|
|||||||
|
|
||||||
import net.minestom.server.entity.GameMode;
|
import net.minestom.server.entity.GameMode;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
|
import net.minestom.server.entity.metadata.PlayerMeta;
|
||||||
import net.minestom.server.event.EventDispatcher;
|
import net.minestom.server.event.EventDispatcher;
|
||||||
import net.minestom.server.event.item.ItemUpdateStateEvent;
|
import net.minestom.server.event.item.ItemUpdateStateEvent;
|
||||||
import net.minestom.server.event.player.PlayerStartDiggingEvent;
|
import net.minestom.server.event.player.PlayerStartDiggingEvent;
|
||||||
@ -136,14 +137,9 @@ public class PlayerDiggingListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (status == ClientPlayerDiggingPacket.Status.UPDATE_ITEM_STATE) {
|
} else if (status == ClientPlayerDiggingPacket.Status.UPDATE_ITEM_STATE) {
|
||||||
Player.Hand hand = null;
|
PlayerMeta meta = player.getEntityMeta();
|
||||||
if (player.isEating()) {
|
if (!meta.isHandActive()) return;
|
||||||
hand = player.getEatingHand();
|
Player.Hand hand = meta.getActiveHand();
|
||||||
} else if (player.getItemInHand(Player.Hand.OFF).getMaterial().hasState()) {
|
|
||||||
hand = Player.Hand.OFF;
|
|
||||||
} else if (player.getItemInHand(Player.Hand.MAIN).getMaterial().hasState()) {
|
|
||||||
hand = Player.Hand.MAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.refreshEating(null);
|
player.refreshEating(null);
|
||||||
player.triggerStatus((byte) 9);
|
player.triggerStatus((byte) 9);
|
||||||
|
Loading…
Reference in New Issue
Block a user