Skip to content

Commit

Permalink
We must take into account the original drop
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Oct 14, 2024
1 parent 4903725 commit ff0c54f
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,31 @@ public synchronized void onUpdateLivingDropsEvent_0(LivingDropsEvent event)
addDamagedItemToDrops(skeleton, drops, skeleton.getHeldItemMainhand(),
DataSkeletonDropItem.ConfigDataSkeletonDrop.instance.getHandItemDamageFactor());

addArrowsToDrops(skeleton, drops,
DataSkeletonDropItem.ConfigDataSkeletonDrop.instance.getArrowsToDrops());
Random rand = new Random();
double arrowDropChance = 0.5;

if (rand.nextDouble() < arrowDropChance)
{
boolean arrowsDropped = false;
for (EntityItem item : drops)
{
if (item.getItem().getItem() == Items.ARROW)
{
int currentCount = item.getItem().getCount();

item.getItem().setCount
(currentCount + 1 + DataSkeletonDropItem.ConfigDataSkeletonDrop.instance.getArrowsToDrops());
arrowsDropped = true;

break;
}
}

if (!arrowsDropped)
{
addArrowsToDrops(skeleton, drops, DataSkeletonDropItem.ConfigDataSkeletonDrop.instance.getArrowsToDrops());
}
}
}
}

Expand Down

0 comments on commit ff0c54f

Please sign in to comment.