mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-01-22 23:41:27 +01:00
Improved the shield handling (1.9->1.8)
This commit is contained in:
parent
d8f55006ff
commit
8e20df57a9
@ -306,18 +306,20 @@ public class WorldPackets {
|
||||
Item item = Protocol1_9TO1_8.getHandItem(wrapper.user());
|
||||
// Blocking patch
|
||||
if (Via.getConfig().isShieldBlocking()) {
|
||||
if (item != null) {
|
||||
if (Protocol1_9TO1_8.isSword(item.getId())) {
|
||||
if (hand == 0) {
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
if (!tracker.isBlocking()) {
|
||||
tracker.setBlocking(true);
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
tracker.setSecondHand(shield);
|
||||
}
|
||||
wrapper.cancel();
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
|
||||
if (item != null && Protocol1_9TO1_8.isSword(item.getId())) {
|
||||
if (hand == 0) {
|
||||
if (!tracker.isBlocking()) {
|
||||
tracker.setBlocking(true);
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
tracker.setSecondHand(shield);
|
||||
}
|
||||
wrapper.cancel();
|
||||
}
|
||||
} else {
|
||||
tracker.setSecondHand(null);
|
||||
tracker.setBlocking(false);
|
||||
}
|
||||
}
|
||||
wrapper.write(Type.ITEM, item);
|
||||
|
@ -162,6 +162,8 @@ public class EntityTracker extends StoredObject {
|
||||
if (validBlocking.contains(entityID)) {
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
setSecondHand(entityID, shield);
|
||||
} else {
|
||||
setSecondHand(entityID, null);
|
||||
}
|
||||
} else {
|
||||
setSecondHand(entityID, null);
|
||||
|
Loading…
Reference in New Issue
Block a user