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

Commit

Permalink
fix: custom food replacement not replacing event-replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Jan 14, 2024
1 parent 73e466c commit c82af32
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ class FoodConsumptionListener : Listener {
val entity = if (hand == EquipmentSlot.HAND) gearyInventory.itemInMainHand else gearyInventory.itemInOffhand ?: return
val gearyFood = entity?.get<Food>() ?: return

val replacement = gearyFood.replacement?.toItemStack()

if (player.gameMode != GameMode.CREATIVE) {
if (replacement != null) {
if (player.inventory.firstEmpty() != -1) player.inventory.addItem(replacement)
else player.world.dropItemNaturally(player.location, replacement)
}
replacement = gearyFood.replacement?.toItemStack()
item.subtract()

if (gearyFood.effectList.isNotEmpty() && Random.nextDouble(0.0, 1.0) <= gearyFood.effectChance)
Expand Down

0 comments on commit c82af32

Please sign in to comment.