Search in sources :

Example 1 with BluePower

use of com.bluepowermod.BluePower in project BluePower by Qmunity.

the class JEIPlugin method getMicroblockRecipes.

private static List<IRecipe<?>> getMicroblockRecipes() {
    List<IRecipe<?>> recipes = new ArrayList<>();
    for (Block block : ForgeRegistries.BLOCKS.getValues().stream().filter(b -> !b.hasTileEntity(b.defaultBlockState())).collect(Collectors.toList())) {
        VoxelShape shape = null;
        try {
            shape = block.defaultBlockState().getShape(null, null);
        } catch (NullPointerException ignored) {
        // Shulker Boxes try to query the Tile Entity
        }
        if (block.getRegistryName() != null && shape == VoxelShapes.block()) {
            ItemStack output = ItemStack.EMPTY;
            for (Block mb : BPBlocks.microblocks) {
                NonNullList<Ingredient> input = NonNullList.create();
                input.add(Ingredient.of(ItemTags.createOptional(new ResourceLocation("bluepower:saw"))));
                if (mb == BPBlocks.half_block) {
                    input.add(Ingredient.of(new ItemStack(block)));
                } else {
                    input.add(Ingredient.of(output));
                }
                CompoundNBT nbt = new CompoundNBT();
                nbt.putString("block", block.getRegistryName().toString());
                ItemStack stack = new ItemStack(mb);
                stack.setTag(nbt);
                stack.setHoverName(new TranslationTextComponent(block.getDescriptionId()).append(new StringTextComponent(" ")).append(new TranslationTextComponent(mb.getDescriptionId())));
                output = stack;
                recipes.add(new ShapelessRecipe(new ResourceLocation("bluepower:" + mb.getDescriptionId() + block.getDescriptionId()), "", output, input));
            }
        }
    }
    return recipes;
}
Also used : Refs(com.bluepowermod.reference.Refs) java.util(java.util) ContainerBlulectricAlloyFurnace(com.bluepowermod.container.ContainerBlulectricAlloyFurnace) GuiBlulectricAlloyFurnace(com.bluepowermod.client.gui.GuiBlulectricAlloyFurnace) Item(net.minecraft.item.Item) BPBlocks(com.bluepowermod.init.BPBlocks) CompoundNBT(net.minecraft.nbt.CompoundNBT) AlloyFurnaceRegistry(com.bluepowermod.recipe.AlloyFurnaceRegistry) net.minecraft.item.crafting(net.minecraft.item.crafting) IGuiHelper(mezz.jei.api.helpers.IGuiHelper) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ContainerBlulectricFurnace(com.bluepowermod.container.ContainerBlulectricFurnace) ItemStack(net.minecraft.item.ItemStack) IAlloyFurnaceRecipe(com.bluepowermod.api.recipe.IAlloyFurnaceRecipe) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) IRecipeCategory(mezz.jei.api.recipe.category.IRecipeCategory) mezz.jei.api(mezz.jei.api) VoxelShape(net.minecraft.util.math.shapes.VoxelShape) StringTextComponent(net.minecraft.util.text.StringTextComponent) NonNullList(net.minecraft.util.NonNullList) VanillaRecipeCategoryUid(mezz.jei.api.constants.VanillaRecipeCategoryUid) ContainerAlloyFurnace(com.bluepowermod.container.ContainerAlloyFurnace) ItemTags(net.minecraft.tags.ItemTags) ContainerProjectTable(com.bluepowermod.container.ContainerProjectTable) ItemStackUtils(com.bluepowermod.util.ItemStackUtils) mezz.jei.api.registration(mezz.jei.api.registration) Collectors(java.util.stream.Collectors) IJeiHelpers(mezz.jei.api.helpers.IJeiHelpers) GuiBlulectricFurnace(com.bluepowermod.client.gui.GuiBlulectricFurnace) ResourceLocation(net.minecraft.util.ResourceLocation) VoxelShapes(net.minecraft.util.math.shapes.VoxelShapes) BluePower(com.bluepowermod.BluePower) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) GuiAlloyFurnace(com.bluepowermod.client.gui.GuiAlloyFurnace) CompoundNBT(net.minecraft.nbt.CompoundNBT) VoxelShape(net.minecraft.util.math.shapes.VoxelShape) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent) ItemStack(net.minecraft.item.ItemStack)

Aggregations

BluePower (com.bluepowermod.BluePower)1 IAlloyFurnaceRecipe (com.bluepowermod.api.recipe.IAlloyFurnaceRecipe)1 GuiAlloyFurnace (com.bluepowermod.client.gui.GuiAlloyFurnace)1 GuiBlulectricAlloyFurnace (com.bluepowermod.client.gui.GuiBlulectricAlloyFurnace)1 GuiBlulectricFurnace (com.bluepowermod.client.gui.GuiBlulectricFurnace)1 ContainerAlloyFurnace (com.bluepowermod.container.ContainerAlloyFurnace)1 ContainerBlulectricAlloyFurnace (com.bluepowermod.container.ContainerBlulectricAlloyFurnace)1 ContainerBlulectricFurnace (com.bluepowermod.container.ContainerBlulectricFurnace)1 ContainerProjectTable (com.bluepowermod.container.ContainerProjectTable)1 BPBlocks (com.bluepowermod.init.BPBlocks)1 AlloyFurnaceRegistry (com.bluepowermod.recipe.AlloyFurnaceRegistry)1 Refs (com.bluepowermod.reference.Refs)1 ItemStackUtils (com.bluepowermod.util.ItemStackUtils)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 mezz.jei.api (mezz.jei.api)1 VanillaRecipeCategoryUid (mezz.jei.api.constants.VanillaRecipeCategoryUid)1 IGuiHelper (mezz.jei.api.helpers.IGuiHelper)1 IJeiHelpers (mezz.jei.api.helpers.IJeiHelpers)1 IRecipeCategory (mezz.jei.api.recipe.category.IRecipeCategory)1