mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed being able to convert any item into botched gems
This commit is contained in:
parent
43ef65261c
commit
4a73cae094
1 changed files with 10 additions and 1 deletions
|
@ -166,7 +166,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
|||
.findFirst()
|
||||
.filter(recipe -> result.shouldCraftRecipe(world, (ServerPlayerEntity)this.inventory.player, recipe))
|
||||
.map(recipe -> recipe.craft(input))
|
||||
.orElse(input.getTraits().applyTo(UItems.BOTCHED_GEM.getDefaultStack())) : ItemStack.EMPTY;
|
||||
.orElseGet(this::getFallbackStack) : ItemStack.EMPTY;
|
||||
outputSlot.setStack(resultStack);
|
||||
|
||||
setPreviousTrackedSlot(outputSlot.id, resultStack);
|
||||
|
@ -175,6 +175,15 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
|||
});
|
||||
}
|
||||
|
||||
private ItemStack getFallbackStack() {
|
||||
ItemStack gemStack = gemSlot.getStack();
|
||||
if (gemStack.isOf(UItems.GEMSTONE) || gemStack.isOf(UItems.BOTCHED_GEM)) {
|
||||
return input.getTraits().applyTo(UItems.BOTCHED_GEM.getDefaultStack());
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
Slot sourceSlot = slots.get(index);
|
||||
|
|
Loading…
Reference in a new issue