Skip to content

Commit

Permalink
fix autoswitch visual update for non-player NPCs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 12, 2023
1 parent 7f92566 commit ad1642d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/mcmonkey/sentinel/SentinelItemHelper.java
Expand Up @@ -221,6 +221,10 @@ public void swapToMatch(Function<ItemStack, Boolean> doSwap, boolean isRanged) {
items[0] = items[bestIndex] == null ? null : items[bestIndex].clone();
items[bestIndex] = held == null ? null : held.clone();
inv.setContents(items);
if (!(sentinel.getLivingEntity() instanceof Player)) {
// Patch for non-player NPCs doing equipment differenty
sentinel.getLivingEntity().getEquipment().setItemInMainHand(items[0]);
}
if (sentinel.getLivingEntity() instanceof Player && bestIndex == 40 && SentinelVersionCompat.v1_9 && sentinel.getLivingEntity().getEquipment() != null) {
// Patch for offhand, which is "in the inventory" but not really tracked through it
sentinel.getLivingEntity().getEquipment().setItemInOffHand(items[bestIndex]);
Expand Down

0 comments on commit ad1642d

Please sign in to comment.