Fix issue with custom anvil craft (#23)

Only remove experience on custom anvil craft if player not in creative.
(fix #21)
Remove the right amount of experience for custom craft.
This commit is contained in:
alexcrea 2024-08-11 04:30:17 +02:00 committed by GitHub
commit d472e19499
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -361,7 +361,10 @@ class AnvilEventListener(private val packetManager: PacketManager) : Listener {
rightItem.amount -= amount * recipe.rightItem!!.amount
inventory.setItem(ANVIL_INPUT_RIGHT, rightItem)
}
player.level -= amount
if(player.gameMode != GameMode.CREATIVE){
player.level -= xpCost
}
// Then we try to find the new values for the anvil
val newAmount = getCustomRecipeAmount(recipe, leftItem, rightItem)