Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Merge pull request #676 from RaynLegends/master
Improved the shield handling (1.9->1.8)
Dieser Commit ist enthalten in:
Commit
56637f50bc
@ -306,10 +306,10 @@ public class WorldPackets {
|
|||||||
Item item = Protocol1_9TO1_8.getHandItem(wrapper.user());
|
Item item = Protocol1_9TO1_8.getHandItem(wrapper.user());
|
||||||
// Blocking patch
|
// Blocking patch
|
||||||
if (Via.getConfig().isShieldBlocking()) {
|
if (Via.getConfig().isShieldBlocking()) {
|
||||||
if (item != null) {
|
|
||||||
if (Protocol1_9TO1_8.isSword(item.getId())) {
|
|
||||||
if (hand == 0) {
|
|
||||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||||
|
|
||||||
|
if (item != null && Protocol1_9TO1_8.isSword(item.getId())) {
|
||||||
|
if (hand == 0) {
|
||||||
if (!tracker.isBlocking()) {
|
if (!tracker.isBlocking()) {
|
||||||
tracker.setBlocking(true);
|
tracker.setBlocking(true);
|
||||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||||
@ -317,7 +317,9 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
tracker.setSecondHand(null);
|
||||||
|
tracker.setBlocking(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.write(Type.ITEM, item);
|
wrapper.write(Type.ITEM, item);
|
||||||
|
@ -162,6 +162,8 @@ public class EntityTracker extends StoredObject {
|
|||||||
if (validBlocking.contains(entityID)) {
|
if (validBlocking.contains(entityID)) {
|
||||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||||
setSecondHand(entityID, shield);
|
setSecondHand(entityID, shield);
|
||||||
|
} else {
|
||||||
|
setSecondHand(entityID, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setSecondHand(entityID, null);
|
setSecondHand(entityID, null);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren