mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-25 06:17:59 +01:00
46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package com.minelittlepony.unicopia.item;
|
|
|
|
import net.minecraft.inventory.CraftingInventory;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.Items;
|
|
import net.minecraft.recipe.RecipeSerializer;
|
|
import net.minecraft.util.Identifier;
|
|
import net.minecraft.util.Pair;
|
|
|
|
public class GlowingRecipe extends ItemCombinationRecipe {
|
|
|
|
public GlowingRecipe(Identifier id) {
|
|
super(id);
|
|
}
|
|
|
|
@Override
|
|
public final ItemStack craft(CraftingInventory inventory) {
|
|
Pair<ItemStack, ItemStack> pair = runMatch(inventory);
|
|
|
|
ItemStack result = pair.getLeft().copy();
|
|
|
|
((GlowableItem)result.getItem()).setGlowing(result, pair.getRight().getItem() == Items.GLOWSTONE_DUST);
|
|
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
protected boolean isContainerItem(ItemStack stack) {
|
|
return stack.getItem() instanceof GlowableItem;
|
|
}
|
|
|
|
@Override
|
|
protected boolean isInsertItem(ItemStack stack) {
|
|
return stack.getItem() == Items.GLOWSTONE_DUST || stack.getItem() == Items.INK_SAC;
|
|
}
|
|
|
|
@Override
|
|
protected boolean isCombinationInvalid(ItemStack bangle, ItemStack dust) {
|
|
return (dust.getItem() == Items.GLOWSTONE_DUST) == ((GlowableItem)bangle.getItem()).isGlowing(bangle);
|
|
}
|
|
|
|
@Override
|
|
public RecipeSerializer<?> getSerializer() {
|
|
return URecipes.GLOWING_SERIALIZER;
|
|
}
|
|
}
|