Skip to content

Commit ad1642d

Browse files
committed
fix autoswitch visual update for non-player NPCs
1 parent 7f92566 commit ad1642d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/org/mcmonkey/sentinel/SentinelItemHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ public void swapToMatch(Function<ItemStack, Boolean> doSwap, boolean isRanged) {
221221
items[0] = items[bestIndex] == null ? null : items[bestIndex].clone();
222222
items[bestIndex] = held == null ? null : held.clone();
223223
inv.setContents(items);
224+
if (!(sentinel.getLivingEntity() instanceof Player)) {
225+
// Patch for non-player NPCs doing equipment differenty
226+
sentinel.getLivingEntity().getEquipment().setItemInMainHand(items[0]);
227+
}
224228
if (sentinel.getLivingEntity() instanceof Player && bestIndex == 40 && SentinelVersionCompat.v1_9 && sentinel.getLivingEntity().getEquipment() != null) {
225229
// Patch for offhand, which is "in the inventory" but not really tracked through it
226230
sentinel.getLivingEntity().getEquipment().setItemInOffHand(items[bestIndex]);

0 commit comments

Comments
 (0)