2021-02-14 21:15:30 +01:00
|
|
|
package com.minelittlepony.unicopia.item;
|
|
|
|
|
2023-06-03 13:40:54 +02:00
|
|
|
import net.minecraft.inventory.RecipeInputInventory;
|
2021-02-14 21:15:30 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.recipe.RecipeSerializer;
|
2022-12-18 22:07:24 +01:00
|
|
|
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
2023-06-02 21:20:30 +02:00
|
|
|
import net.minecraft.registry.DynamicRegistryManager;
|
2021-02-14 21:15:30 +01:00
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
import net.minecraft.util.Pair;
|
|
|
|
|
|
|
|
public class JarInsertRecipe extends ItemCombinationRecipe {
|
|
|
|
|
2022-12-18 22:07:24 +01:00
|
|
|
public JarInsertRecipe(Identifier id, CraftingRecipeCategory category) {
|
|
|
|
super(id, category);
|
2021-02-14 21:15:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-06-03 13:40:54 +02:00
|
|
|
public final ItemStack craft(RecipeInputInventory inventory, DynamicRegistryManager registries) {
|
2021-02-14 21:15:30 +01:00
|
|
|
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
|
|
|
|
2021-02-14 22:13:12 +01:00
|
|
|
return UItems.FILLED_JAR.setAppearance(UItems.FILLED_JAR.getDefaultStack(), pair.getRight());
|
2021-02-14 21:15:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean isContainerItem(ItemStack stack) {
|
|
|
|
return stack.getItem() == UItems.EMPTY_JAR;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean isInsertItem(ItemStack stack) {
|
|
|
|
return !(stack.getItem() instanceof JarItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean isCombinationInvalid(ItemStack bangle, ItemStack dust) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public RecipeSerializer<?> getSerializer() {
|
|
|
|
return URecipes.JAR_INSERT_SERIALIZER;
|
|
|
|
}
|
|
|
|
}
|