mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Fixed crash due to skeletons stealing items/having their bows stolen. Closes #53
This commit is contained in:
parent
8aebf82eff
commit
75a63e7a97
1 changed files with 5 additions and 3 deletions
|
@ -62,12 +62,14 @@ public class WantItTakeItGoal extends BreakHeartGoal {
|
|||
mob.swingHand(Hand.MAIN_HAND);
|
||||
|
||||
if (mob.world.random.nextInt(20) == 0) {
|
||||
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
ItemStack stack = ((LivingEntity)target).getEquippedStack(slot);
|
||||
if (EnchantmentHelper.getLevel(UEnchantments.WANT_IT_NEED_IT, stack) > 0) {
|
||||
target.equipStack(slot, ItemStack.EMPTY);
|
||||
AwaitTickQueue.scheduleTask(mob.world, w -> mob.tryEquip(stack));
|
||||
AwaitTickQueue.scheduleTask(mob.world, w -> {
|
||||
target.equipStack(slot, ItemStack.EMPTY);
|
||||
mob.tryEquip(stack);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue