use of pl.asie.charset.lib.recipe.RecipeCharset in project Charset by CharsetMC.
the class SubItemProviderRecipes method createItemSets.
@Override
protected List<List<ItemStack>> createItemSets() {
List<List<ItemStack>> list = new ArrayList<>();
Item item = itemSupplier.get();
if (group == null) {
group = item.getRegistryName().toString();
}
ItemStackHashSet stackSet = new ItemStackHashSet(false, true, true);
for (IRecipe recipe : ForgeRegistries.RECIPES) {
if ((group == null || group.equals(recipe.getGroup())) && !recipe.getRecipeOutput().isEmpty() && recipe.getRecipeOutput().getItem() == item) {
if (recipe instanceof RecipeCharset) {
for (ItemStack s : ((RecipeCharset) recipe).getAllRecipeOutputs()) {
if (stackSet.add(s)) {
List<ItemStack> stacks = createSetFor(s);
if (stacks != null && stacks.size() > 0)
list.add(stacks);
}
}
} else {
ItemStack s = recipe.getRecipeOutput();
if (stackSet.add(s)) {
List<ItemStack> stacks = createSetFor(s);
if (stacks != null && stacks.size() > 0)
list.add(stacks);
}
}
}
}
return list;
}
use of pl.asie.charset.lib.recipe.RecipeCharset in project Charset by CharsetMC.
the class JEIPluginCharset method register.
@Override
public void register(@Nonnull IModRegistry registry) {
STACKS = registry.getJeiHelpers().getStackHelper();
GUIS = registry.getJeiHelpers().getGuiHelper();
RECIPE_TRANSFER_HANDLERS = registry.getJeiHelpers().recipeTransferHandlerHelper();
for (IRecipe recipe : ForgeRegistries.RECIPES) {
if (recipe instanceof RecipeCharset) {
InventoryCraftingIterator iterator = new InventoryCraftingIterator((RecipeCharset) recipe, false);
while (iterator.hasNext()) {
iterator.next();
if (recipe.matches(iterator, null)) {
InventoryCraftingIterator.Container ctr = iterator.contain();
registry.addRecipes(Collections.singletonList(ctr), VanillaRecipeCategoryUid.CRAFTING);
}
}
}
}
// registry.handleRecipes(RecipeCharset.class, JEIRecipeCharset::create, VanillaRecipeCategoryUid.CRAFTING);
registry.handleRecipes(InventoryCraftingIterator.Container.class, JEIRecipeContainer::create, VanillaRecipeCategoryUid.CRAFTING);
registry.handleRecipes(DyeableItemRecipeFactory.Recipe.class, JEIRecipeDyeableItem::create, VanillaRecipeCategoryUid.CRAFTING);
for (IModPlugin plugin : getPlugins()) {
plugin.register(registry);
}
}
Aggregations