Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Fix looting calculation on drops
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Dec 27, 2023
1 parent e3a5149 commit bb493e7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import kotlin.random.Random
* @param cooked The cooked version of this item.
* @param cookExp The amount of exp to drop when this item is cooked.
* @param cookTime How long it takes for this item to cook
* @param minAmount The minimum stack size of this item.
* @param maxAmount The maximum stack size of this item.
* @param amount A range for the stack size of this item.
* @param dropChance A chance from 0 to 1 for this item to be dropped.
*
*/
Expand All @@ -38,7 +37,7 @@ data class MobDrop(

val lootingMaxAmount: Int =
if (dropChance >= 0.5)
(amount.first + lootingLevel * Random.nextDouble()).roundToInt()
(amount.last + lootingLevel * Random.nextDouble()).roundToInt()
else amount.last

val lootingDropChance =
Expand All @@ -53,7 +52,7 @@ data class MobDrop(
else item.toItemStack()
drop.amount =
if (lootingMaxAmount <= amount.first) amount.first
else Random.nextInt(amount.last, lootingMaxAmount)
else Random.nextInt(amount.first, lootingMaxAmount)
drop
} else null
}
Expand Down

0 comments on commit bb493e7

Please sign in to comment.