Search in sources :

Example 1 with IDisplayModifierRecipe

use of slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe in project TinkersConstruct by SlimeKnights.

the class ArmorDyeingRecipe method getRecipes.

@Override
public List<IDisplayModifierRecipe> getRecipes() {
    if (displayRecipes == null) {
        List<ItemStack> toolInputs = Arrays.stream(this.toolRequirement.getItems()).map(stack -> {
            if (stack.getItem() instanceof IModifiableDisplay) {
                return ((IModifiableDisplay) stack.getItem()).getRenderTool();
            }
            return stack;
        }).toList();
        ModifierEntry result = new ModifierEntry(TinkerModifiers.dyed.get(), 1);
        displayRecipes = Arrays.stream(DyeColor.values()).map(dye -> new DisplayRecipe(result, toolInputs, dye)).collect(Collectors.toList());
    }
    return displayRecipes;
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) JsonObject(com.google.gson.JsonObject) LoggingRecipeSerializer(slimeknights.mantle.recipe.helper.LoggingRecipeSerializer) DyeColor(net.minecraft.world.item.DyeColor) Arrays(java.util.Arrays) Tag(net.minecraft.nbt.Tag) IDisplayModifierRecipe(slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe) Getter(lombok.Getter) RequiredArgsConstructor(lombok.RequiredArgsConstructor) TinkerModifiers(slimeknights.tconstruct.tools.TinkerModifiers) FriendlyByteBuf(net.minecraft.network.FriendlyByteBuf) IMultiRecipe(slimeknights.mantle.recipe.IMultiRecipe) Ingredient(net.minecraft.world.item.crafting.Ingredient) ImmutableList(com.google.common.collect.ImmutableList) IModifiableDisplay(slimeknights.tconstruct.library.tools.item.IModifiableDisplay) ModifierEntry(slimeknights.tconstruct.library.modifiers.ModifierEntry) Nullable(javax.annotation.Nullable) ModDataNBT(slimeknights.tconstruct.library.tools.nbt.ModDataNBT) RecipeSerializer(net.minecraft.world.item.crafting.RecipeSerializer) FinishedRecipe(net.minecraft.data.recipes.FinishedRecipe) ITinkerStationContainer(slimeknights.tconstruct.library.recipe.tinkerstation.ITinkerStationContainer) Collectors(java.util.stream.Collectors) Items(net.minecraftforge.common.Tags.Items) ITinkerStationRecipe(slimeknights.tconstruct.library.recipe.tinkerstation.ITinkerStationRecipe) List(java.util.List) Modifier(slimeknights.tconstruct.library.modifiers.Modifier) ItemStack(net.minecraft.world.item.ItemStack) Level(net.minecraft.world.level.Level) ToolStack(slimeknights.tconstruct.library.tools.nbt.ToolStack) IModifiableDisplay(slimeknights.tconstruct.library.tools.item.IModifiableDisplay) ModifierEntry(slimeknights.tconstruct.library.modifiers.ModifierEntry) ItemStack(net.minecraft.world.item.ItemStack)

Example 2 with IDisplayModifierRecipe

use of slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe in project TinkersConstruct by SlimeKnights.

the class JEIPlugin method registerRecipes.

@Override
public void registerRecipes(IRecipeRegistration register) {
    assert Minecraft.getInstance().level != null;
    RecipeManager manager = Minecraft.getInstance().level.getRecipeManager();
    // casting
    List<IDisplayableCastingRecipe> castingBasinRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.CASTING_BASIN, IDisplayableCastingRecipe.class);
    register.addRecipes(castingBasinRecipes, TConstructRecipeCategoryUid.castingBasin);
    List<IDisplayableCastingRecipe> castingTableRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.CASTING_TABLE, IDisplayableCastingRecipe.class);
    register.addRecipes(castingTableRecipes, TConstructRecipeCategoryUid.castingTable);
    // melting
    List<MeltingRecipe> meltingRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.MELTING, MeltingRecipe.class);
    register.addRecipes(meltingRecipes, TConstructRecipeCategoryUid.melting);
    register.addRecipes(meltingRecipes, TConstructRecipeCategoryUid.foundry);
    MeltingFuelHandler.setMeltngFuels(RecipeHelper.getRecipes(manager, RecipeTypes.FUEL, MeltingFuel.class));
    // entity melting
    List<EntityMeltingRecipe> entityMeltingRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.ENTITY_MELTING, EntityMeltingRecipe.class);
    // generate a "default" recipe for all other entity types
    entityMeltingRecipes.add(new DefaultEntityMeltingRecipe(entityMeltingRecipes));
    register.addRecipes(entityMeltingRecipes, TConstructRecipeCategoryUid.entityMelting);
    // alloying
    List<AlloyRecipe> alloyRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.ALLOYING, AlloyRecipe.class);
    register.addRecipes(alloyRecipes, TConstructRecipeCategoryUid.alloy);
    // molding
    List<MoldingRecipe> moldingRecipes = ImmutableList.<MoldingRecipe>builder().addAll(RecipeHelper.getJEIRecipes(manager, RecipeTypes.MOLDING_TABLE, MoldingRecipe.class)).addAll(RecipeHelper.getJEIRecipes(manager, RecipeTypes.MOLDING_BASIN, MoldingRecipe.class)).build();
    register.addRecipes(moldingRecipes, TConstructRecipeCategoryUid.molding);
    // modifiers
    List<IDisplayModifierRecipe> modifierRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.TINKER_STATION, IDisplayModifierRecipe.class).stream().sorted((r1, r2) -> {
        SlotType t1 = r1.getSlotType();
        SlotType t2 = r2.getSlotType();
        String n1 = t1 == null ? "zzzzzzzzzz" : t1.getName();
        String n2 = t2 == null ? "zzzzzzzzzz" : t2.getName();
        return n1.compareTo(n2);
    }).collect(Collectors.toList());
    register.addRecipes(modifierRecipes, TConstructRecipeCategoryUid.modifiers);
    // beheading
    List<SeveringRecipe> severingRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.SEVERING, SeveringRecipe.class);
    register.addRecipes(severingRecipes, TConstructRecipeCategoryUid.severing);
    // part builder
    List<MaterialRecipe> materialRecipes = RecipeHelper.getRecipes(manager, RecipeTypes.MATERIAL, MaterialRecipe.class);
    MaterialItemList.setRecipes(materialRecipes);
    List<IDisplayPartBuilderRecipe> partRecipes = RecipeHelper.getJEIRecipes(manager, RecipeTypes.PART_BUILDER, IDisplayPartBuilderRecipe.class);
    register.addRecipes(partRecipes, TConstructRecipeCategoryUid.partBuilder);
}
Also used : HeatingStructureScreen(slimeknights.tconstruct.smeltery.client.screen.HeatingStructureScreen) Item(net.minecraft.world.item.Item) MeltingFuel(slimeknights.tconstruct.library.recipe.fuel.MeltingFuel) RecipeHelper(slimeknights.mantle.recipe.helper.RecipeHelper) Config(slimeknights.tconstruct.common.config.Config) UidContext(mezz.jei.api.ingredients.subtypes.UidContext) IGuiHelper(mezz.jei.api.helpers.IGuiHelper) SlotType(slimeknights.tconstruct.library.tools.SlotType) CastItemObject(slimeknights.tconstruct.common.registration.CastItemObject) CastingTableCategory(slimeknights.tconstruct.plugin.jei.casting.CastingTableCategory) ArmorSlotType(slimeknights.tconstruct.tools.item.ArmorSlotType) RecipeType(net.minecraft.world.item.crafting.RecipeType) VanillaRecipeCategoryUid(mezz.jei.api.constants.VanillaRecipeCategoryUid) ModList(net.minecraftforge.fml.ModList) IGuiHandlerRegistration(mezz.jei.api.registration.IGuiHandlerRegistration) IGuiContainerHandler(mezz.jei.api.gui.handlers.IGuiContainerHandler) TinkerTools(slimeknights.tconstruct.tools.TinkerTools) AlloyRecipe(slimeknights.tconstruct.library.recipe.alloying.AlloyRecipe) SeveringCategory(slimeknights.tconstruct.plugin.jei.entity.SeveringCategory) IDisplayableCastingRecipe(slimeknights.tconstruct.library.recipe.casting.IDisplayableCastingRecipe) IMaterialItem(slimeknights.tconstruct.library.tools.part.IMaterialItem) IIngredientType(mezz.jei.api.ingredients.IIngredientType) Modifier(slimeknights.tconstruct.library.modifiers.Modifier) FluidStack(net.minecraftforge.fluids.FluidStack) CastingBasinCategory(slimeknights.tconstruct.plugin.jei.casting.CastingBasinCategory) ItemStack(net.minecraft.world.item.ItemStack) MaterialIdNBT(slimeknights.tconstruct.library.tools.nbt.MaterialIdNBT) IRecipeCatalystRegistration(mezz.jei.api.registration.IRecipeCatalystRegistration) IDisplayModifierRecipe(slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe) MeltingRecipe(slimeknights.tconstruct.library.recipe.melting.MeltingRecipe) EntityType(net.minecraft.world.entity.EntityType) AbstractContainerMenu(net.minecraft.world.inventory.AbstractContainerMenu) ModifierBookmarkIngredientRenderer(slimeknights.tconstruct.plugin.jei.modifiers.ModifierBookmarkIngredientRenderer) TinkerModifiers(slimeknights.tconstruct.tools.TinkerModifiers) IModPlugin(mezz.jei.api.IModPlugin) Container(net.minecraft.world.Container) EntityIngredientRenderer(slimeknights.tconstruct.plugin.jei.entity.EntityIngredientRenderer) IModifiableDisplay(slimeknights.tconstruct.library.tools.item.IModifiableDisplay) IModIngredientRegistration(mezz.jei.api.registration.IModIngredientRegistration) IRecipeTransferRegistration(mezz.jei.api.registration.IRecipeTransferRegistration) CopperCanItem(slimeknights.tconstruct.smeltery.item.CopperCanItem) MeltingCategory(slimeknights.tconstruct.plugin.jei.melting.MeltingCategory) Nullable(javax.annotation.Nullable) RecipeTypes(slimeknights.tconstruct.library.recipe.RecipeTypes) MelterScreen(slimeknights.tconstruct.smeltery.client.screen.MelterScreen) DefaultEntityMeltingRecipe(slimeknights.tconstruct.plugin.jei.entity.DefaultEntityMeltingRecipe) Tag(net.minecraft.tags.Tag) MaterialVariantId(slimeknights.tconstruct.library.materials.definition.MaterialVariantId) Pattern(slimeknights.tconstruct.library.recipe.partbuilder.Pattern) IScreenWithFluidTank(slimeknights.tconstruct.smeltery.client.screen.IScreenWithFluidTank) TinkerSmeltery(slimeknights.tconstruct.smeltery.TinkerSmeltery) RetexturedBlockItem(slimeknights.mantle.item.RetexturedBlockItem) MoldingRecipe(slimeknights.tconstruct.library.recipe.molding.MoldingRecipe) ModifierIngredientHelper(slimeknights.tconstruct.plugin.jei.modifiers.ModifierIngredientHelper) ResourceLocation(net.minecraft.resources.ResourceLocation) PatternIngredientHelper(slimeknights.tconstruct.plugin.jei.partbuilder.PatternIngredientHelper) EntityIngredientHelper(slimeknights.tconstruct.plugin.jei.entity.EntityIngredientHelper) FluidAttributes(net.minecraftforge.fluids.FluidAttributes) EntityMeltingRecipeCategory(slimeknights.tconstruct.plugin.jei.entity.EntityMeltingRecipeCategory) Registry(net.minecraft.core.Registry) IIngredientManager(mezz.jei.api.runtime.IIngredientManager) CreativeSlotItem(slimeknights.tconstruct.tools.item.CreativeSlotItem) IDisplayPartBuilderRecipe(slimeknights.tconstruct.library.recipe.partbuilder.IDisplayPartBuilderRecipe) ModifierEntry(slimeknights.tconstruct.library.modifiers.ModifierEntry) MeltingFuelHandler(slimeknights.tconstruct.plugin.jei.melting.MeltingFuelHandler) PartBuilderCategory(slimeknights.tconstruct.plugin.jei.partbuilder.PartBuilderCategory) EntityMeltingRecipe(slimeknights.tconstruct.library.recipe.entitymelting.EntityMeltingRecipe) IMaterial(slimeknights.tconstruct.library.materials.definition.IMaterial) TinkerTables(slimeknights.tconstruct.tables.TinkerTables) TinkerTags(slimeknights.tconstruct.common.TinkerTags) IRecipeCategoryRegistration(mezz.jei.api.registration.IRecipeCategoryRegistration) Collectors(java.util.stream.Collectors) List(java.util.List) FoundryCategory(slimeknights.tconstruct.plugin.jei.melting.FoundryCategory) RecipeManager(net.minecraft.world.item.crafting.RecipeManager) IIngredientSubtypeInterpreter(mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter) ISubtypeRegistration(mezz.jei.api.registration.ISubtypeRegistration) MaterialRecipe(slimeknights.tconstruct.library.recipe.material.MaterialRecipe) VanillaTypes(mezz.jei.api.constants.VanillaTypes) IJeiRuntime(mezz.jei.api.runtime.IJeiRuntime) AbstractContainerScreen(net.minecraft.client.gui.screens.inventory.AbstractContainerScreen) SeveringRecipe(slimeknights.tconstruct.library.recipe.modifiers.severing.SeveringRecipe) JeiPlugin(mezz.jei.api.JeiPlugin) ImmutableList(com.google.common.collect.ImmutableList) Minecraft(net.minecraft.client.Minecraft) ItemLike(net.minecraft.world.level.ItemLike) IRecipeRegistration(mezz.jei.api.registration.IRecipeRegistration) Fluid(net.minecraft.world.level.material.Fluid) TinkerMaterials(slimeknights.tconstruct.shared.TinkerMaterials) SerializationTags(net.minecraft.tags.SerializationTags) PatternIngredientRenderer(slimeknights.tconstruct.plugin.jei.partbuilder.PatternIngredientRenderer) TinkerFluids(slimeknights.tconstruct.fluids.TinkerFluids) MaterialItemList(slimeknights.tconstruct.plugin.jei.partbuilder.MaterialItemList) SmelteryCompat(slimeknights.tconstruct.smeltery.data.SmelteryCompat) Recipe(net.minecraft.world.item.crafting.Recipe) ModifierRecipeCategory(slimeknights.tconstruct.plugin.jei.modifiers.ModifierRecipeCategory) Comparator(java.util.Comparator) Collections(java.util.Collections) TinkerStationTransferInfo(slimeknights.tconstruct.plugin.jei.transfer.TinkerStationTransferInfo) MeltingFuel(slimeknights.tconstruct.library.recipe.fuel.MeltingFuel) DefaultEntityMeltingRecipe(slimeknights.tconstruct.plugin.jei.entity.DefaultEntityMeltingRecipe) EntityMeltingRecipe(slimeknights.tconstruct.library.recipe.entitymelting.EntityMeltingRecipe) IDisplayModifierRecipe(slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe) IDisplayableCastingRecipe(slimeknights.tconstruct.library.recipe.casting.IDisplayableCastingRecipe) MoldingRecipe(slimeknights.tconstruct.library.recipe.molding.MoldingRecipe) MaterialRecipe(slimeknights.tconstruct.library.recipe.material.MaterialRecipe) SlotType(slimeknights.tconstruct.library.tools.SlotType) ArmorSlotType(slimeknights.tconstruct.tools.item.ArmorSlotType) MeltingRecipe(slimeknights.tconstruct.library.recipe.melting.MeltingRecipe) DefaultEntityMeltingRecipe(slimeknights.tconstruct.plugin.jei.entity.DefaultEntityMeltingRecipe) EntityMeltingRecipe(slimeknights.tconstruct.library.recipe.entitymelting.EntityMeltingRecipe) AlloyRecipe(slimeknights.tconstruct.library.recipe.alloying.AlloyRecipe) SeveringRecipe(slimeknights.tconstruct.library.recipe.modifiers.severing.SeveringRecipe) RecipeManager(net.minecraft.world.item.crafting.RecipeManager) DefaultEntityMeltingRecipe(slimeknights.tconstruct.plugin.jei.entity.DefaultEntityMeltingRecipe) IDisplayPartBuilderRecipe(slimeknights.tconstruct.library.recipe.partbuilder.IDisplayPartBuilderRecipe)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Nullable (javax.annotation.Nullable)2 ResourceLocation (net.minecraft.resources.ResourceLocation)2 ItemStack (net.minecraft.world.item.ItemStack)2 Modifier (slimeknights.tconstruct.library.modifiers.Modifier)2 ModifierEntry (slimeknights.tconstruct.library.modifiers.ModifierEntry)2 IDisplayModifierRecipe (slimeknights.tconstruct.library.recipe.modifiers.adding.IDisplayModifierRecipe)2 IModifiableDisplay (slimeknights.tconstruct.library.tools.item.IModifiableDisplay)2 TinkerModifiers (slimeknights.tconstruct.tools.TinkerModifiers)2 JsonObject (com.google.gson.JsonObject)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 Getter (lombok.Getter)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 IModPlugin (mezz.jei.api.IModPlugin)1 JeiPlugin (mezz.jei.api.JeiPlugin)1 VanillaRecipeCategoryUid (mezz.jei.api.constants.VanillaRecipeCategoryUid)1