From 89879494df3110ac0623e100a4b46b1008812e71 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 15 Sep 2022 21:50:28 +0200 Subject: [PATCH] Grant the player experience when crafting spells --- .../unicopia/container/inventory/OutputSlot.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/container/inventory/OutputSlot.java b/src/main/java/com/minelittlepony/unicopia/container/inventory/OutputSlot.java index c64637c9..5847f96b 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/inventory/OutputSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/container/inventory/OutputSlot.java @@ -12,6 +12,7 @@ import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; import net.minecraft.screen.slot.CraftingResultSlot; import net.minecraft.sound.SoundCategory; +import net.minecraft.util.math.MathHelper; public class OutputSlot extends CraftingResultSlot implements SpellbookSlot { private final SpellbookScreenHandler handler; @@ -54,7 +55,7 @@ public class OutputSlot extends CraftingResultSlot implements SpellbookSlot { InventoryUtil.stream(input).forEach(s -> { pony.getDiscoveries().unlock(s.getItem()); }); - //gemSlot.setStack(ItemStack.EMPTY); + pony.getMagicalReserves().getXp().add(MathHelper.clamp(player.world.getRandom().nextFloat() / 10F, 0.001F, 0.3F)); super.onTakeItem(player, stack); } } \ No newline at end of file