Jump to content

[Solved][1.16.5] Recipes not generating


NindyBun

Recommended Posts

I'm trying to follow how SimplyBackpacks does their backpack upgrading recipes but when I try to see my recipes in the game it doesn't show up. I'm assuming something about my recipes is not registering correctly but I don't know where or why it's happening.

Main Class

package com.nindybun.usefulguns;

import com.nindybun.usefulguns.data.Generator;
import com.nindybun.usefulguns.util.RecipeUnlocker;
import com.nindybun.usefulguns.crafting.TargetNBTIngredient;
import com.nindybun.usefulguns.gui.PouchScreen;
import com.nindybun.usefulguns.modRegistries.ModContainers;
import com.nindybun.usefulguns.modRegistries.ModItems;
import com.nindybun.usefulguns.modRegistries.ModRecipes;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(UsefulGuns.MOD_ID)
public class UsefulGuns
{
    public static final String MOD_ID = "usefulguns";

    public static final Logger LOGGER = LogManager.getLogger();

    public UsefulGuns() {
        final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

        ModItems.ITEMS.register(modEventBus);
        ModContainers.CONTAINERS.register(modEventBus);
        ModRecipes.RECIPES.register(modEventBus);
        modEventBus.addListener(Generator::gatherData);

        RecipeUnlocker.register(MOD_ID, MinecraftForge.EVENT_BUS, 1);

        modEventBus.addListener(this::setup);
        modEventBus.addListener(this::doClientStuff);

        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event) {
        event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER));
    }

    private void doClientStuff(final FMLClientSetupEvent event) {
        ScreenManager.register(ModContainers.POUCH_CONTAINER.get(), PouchScreen::new);
    }

    public static ItemGroup itemGroup = new ItemGroup(UsefulGuns.MOD_ID) {
        @Override
        public ItemStack makeIcon() {
            return new ItemStack(ModItems.IRON_POUCH.get());
        }
    };

}

Recipe Register

package com.nindybun.usefulguns.modRegistries;

import com.nindybun.usefulguns.UsefulGuns;
import com.nindybun.usefulguns.crafting.CopyPouchData;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class ModRecipes {
    public static final DeferredRegister<IRecipeSerializer<?>> RECIPES = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, UsefulGuns.MOD_ID);

    public static final RegistryObject<IRecipeSerializer<?>> COPY_RECIPE = RECIPES.register("pouch_upgrade", CopyPouchData.Serializer::new);
}

 

Edited by NindyBun
solved
Link to comment
Share on other sites

  • NindyBun changed the title to [Solved][1.16.5] Recipes not generating
  • ChampionAsh5357 locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.