mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-25 14:14:32 +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()
|
.findFirst()
|
||||||
.filter(recipe -> result.shouldCraftRecipe(world, (ServerPlayerEntity)this.inventory.player, recipe))
|
.filter(recipe -> result.shouldCraftRecipe(world, (ServerPlayerEntity)this.inventory.player, recipe))
|
||||||
.map(recipe -> recipe.craft(input))
|
.map(recipe -> recipe.craft(input))
|
||||||
.orElse(input.getTraits().applyTo(UItems.BOTCHED_GEM.getDefaultStack())) : ItemStack.EMPTY;
|
.orElseGet(this::getFallbackStack) : ItemStack.EMPTY;
|
||||||
outputSlot.setStack(resultStack);
|
outputSlot.setStack(resultStack);
|
||||||
|
|
||||||
setPreviousTrackedSlot(outputSlot.id, 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
|
@Override
|
||||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||||
Slot sourceSlot = slots.get(index);
|
Slot sourceSlot = slots.get(index);
|
||||||
|
|
Loading…
Reference in a new issue