2017-07-10 17:59:43 +02:00
|
|
|
package malte0811.industrialWires.crafting.factories;
|
|
|
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
import ic2.api.item.IC2Items;
|
2017-07-10 20:30:18 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2017-07-10 17:59:43 +02:00
|
|
|
import net.minecraft.item.crafting.Ingredient;
|
|
|
|
import net.minecraftforge.common.crafting.IIngredientFactory;
|
2017-07-10 20:30:18 +02:00
|
|
|
import net.minecraftforge.common.crafting.IngredientNBT;
|
2017-07-10 17:59:43 +02:00
|
|
|
import net.minecraftforge.common.crafting.JsonContext;
|
|
|
|
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
|
|
|
|
public class IC2ItemFactory implements IIngredientFactory {
|
|
|
|
@Nonnull
|
|
|
|
@Override
|
|
|
|
public Ingredient parse(JsonContext context, JsonObject json) {
|
|
|
|
String name = json.get("name").getAsString();
|
|
|
|
String variant = json.get("variant").getAsString();
|
2017-07-10 20:30:18 +02:00
|
|
|
return new MyNBTIngredient(IC2Items.getItem(name, variant));
|
|
|
|
}
|
|
|
|
private class MyNBTIngredient extends IngredientNBT {
|
|
|
|
|
|
|
|
public MyNBTIngredient(ItemStack stack) {
|
|
|
|
super(stack);
|
|
|
|
}
|
2017-07-10 17:59:43 +02:00
|
|
|
}
|
|
|
|
}
|