use of slimeknights.tconstruct.library.recipe.casting.IDisplayableCastingRecipe in project TinkersConstruct by SlimeKnights.
the class ContentMaterialSkull method getSkullRecipe.
/**
* Gets the recipe to cast this skull
*/
@Nullable
private IDisplayableCastingRecipe getSkullRecipe() {
Level world = Minecraft.getInstance().level;
if (!searchedSkullRecipe && world != null) {
skullRecipe = world.getRecipeManager().getAllRecipesFor(RecipeTypes.CASTING_BASIN).stream().filter(recipe -> recipe instanceof IDisplayableCastingRecipe).map(recipe -> (IDisplayableCastingRecipe) recipe).filter(recipe -> {
ItemStack output = recipe.getOutput();
return output.getItem() == TinkerTools.slimesuit.get(ArmorSlotType.HELMET) && MaterialIdNBT.from(output).getMaterial(0).getId().toString().equals(materialName);
}).findFirst().orElse(null);
searchedSkullRecipe = true;
}
return skullRecipe;
}
use of slimeknights.tconstruct.library.recipe.casting.IDisplayableCastingRecipe 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);
}
use of slimeknights.tconstruct.library.recipe.casting.IDisplayableCastingRecipe in project TinkersConstruct by SlimeKnights.
the class ContentMaterialSkull method addPrimaryDisplayItems.
@Override
protected void addPrimaryDisplayItems(List<ItemElement> displayTools, MaterialVariantId materialId) {
displayTools.add(new TinkerItemElement(TinkerToolParts.repairKit.get().withMaterialForDisplay(materialId)));
super.addPrimaryDisplayItems(displayTools, materialId);
// add skull recipe to display items
IDisplayableCastingRecipe skullRecipe = getSkullRecipe();
if (skullRecipe != null) {
// add repair kit
List<ItemStack> casts = skullRecipe.getCastItems();
if (!casts.isEmpty()) {
ItemElement elementItem = new TinkerItemElement(0, 0, 1, casts);
elementItem.tooltip = ImmutableList.of(new TranslatableComponent(SKULL_FROM, casts.get(0).getHoverName()));
displayTools.add(elementItem);
}
}
}
Aggregations