mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Fixed spellbook still consuming items even if you haven't crafted anything
This commit is contained in:
parent
f59c1833e3
commit
4dffafda01
2 changed files with 31 additions and 21 deletions
|
@ -78,10 +78,12 @@ public class ContainerSpellBook extends Container {
|
|||
if (!crafted.isEmpty()) {
|
||||
current = SpellRegistry.instance().enchantStack(current, crafted);
|
||||
|
||||
resultSlot.setCrafted(true);
|
||||
player.playSound(SoundEvents.BLOCK_NOTE_CHIME, 1, 1);
|
||||
} else {
|
||||
current = SpellRegistry.instance().disenchantStack(current);
|
||||
|
||||
resultSlot.setCrafted(false);
|
||||
player.playSound(SoundEvents.BLOCK_NOTE_BASS, 1, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ public class SlotEnchantingResult extends SlotEnchanting {
|
|||
|
||||
private IPageUnlockListener listener;
|
||||
|
||||
private boolean crafted;
|
||||
|
||||
public SlotEnchantingResult(IPageUnlockListener listener, IPageOwner owner, InventorySpellBook craftMatric, IInventory inventory, int index, int xPosition, int yPosition) {
|
||||
super(inventory, index, xPosition, yPosition);
|
||||
this.owner = owner;
|
||||
|
@ -31,8 +33,13 @@ public class SlotEnchantingResult extends SlotEnchanting {
|
|||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setCrafted(boolean crafted) {
|
||||
this.crafted = crafted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onTake(EntityPlayer player, ItemStack stack) {
|
||||
if (crafted) {
|
||||
onCrafting(stack);
|
||||
|
||||
ItemStack current = craftMatrix.getCraftResultMatrix().getStackInSlot(0);
|
||||
|
@ -65,6 +72,7 @@ public class SlotEnchantingResult extends SlotEnchanting {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTake(player, stack);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue