Jump to content

[1.12.2] Game not recognizing the name of an item block for a recipe


theSeaMan69

Recommended Posts

This has been bugging me for a while because I can't find out why the recipes are not working and when I check the logs it says that the block is unknown. This is only happening for recipes that use blocks from my mod and the example I gave is only for one of the recipes. Thank you for your help.

 

logs.PNG.bfdaad5bbfdc2c9c2390cff9032f5be8.PNG

 

recipe.thumb.PNG.43be698849b51327bd6690c8b34f355d.PNG 

Link to comment
Share on other sites

1) Code is text (as are errors) so post them as text not images

2) Post your code

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "C",
    "C",
    "S"
  ],

  "key":
  {
    "C":
    {
      "item": "cummod:cum_stone"
    },

    "S":
    {
      "item": "minecraft:stick"
    }
  },

  "result":
  {
    "item": "cummod:cum_stone_sword",
    "count": 1
  }
}

 

package assets.cummod;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.*;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;


@Mod(modid = CumMod.MODID, name = CumMod.NAME, version = CumMod.VERSION, acceptedMinecraftVersions = CumMod.MC_VERSION)
public class CumMod {

    public static final String MODID = "cummod";
    public static final String NAME = "Cum Mod";
    public static final String VERSION = "1.0";
    public static final String MC_VERSION = "[1.12.2]";
    public static final String RESOURCE_INVENTORY  = "inventory";


    public static Block cumOre;
    public static Block cumBlock;

    public static Item.ToolMaterial sock;

    public static Item.ToolMaterial cumStone;
    public static Item.ToolMaterial hardenedCum;

    public static ArrayList<Block> blocks;
    public static ArrayList<Item> items;

    private static Logger logger;

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        logger = event.getModLog();

        //sock = EnumHelper.addArmorMaterial()

        cumStone = EnumHelper.addToolMaterial("Cum Stone",2,1800,20f,3,30);

        blocks = new ArrayList<>();
        blocks.add(new CumOre(Material.ROCK));
        blocks.add(new CumBlock());
        blocks.add(new CumStone());
        blocks.forEach(b -> registerBlock(b));

        items = new ArrayList<>();
        items.add(new Item().setRegistryName(MODID,"cum_drop").setUnlocalizedName("cum_drop").setCreativeTab(CreativeTabs.BREWING));
        items.add(new ItemSword(cumStone).setRegistryName(MODID,"cum_stone_sword").setUnlocalizedName("cum_stone_sword").setCreativeTab(CreativeTabs.COMBAT).setMaxDamage(10));
        //items.add(new ItemArmor())
        items.forEach(i -> ForgeRegistries.ITEMS.register(i));
        items.forEach(i -> ModelLoader.setCustomModelResourceLocation(i,0,new ModelResourceLocation(i.getRegistryName(),RESOURCE_INVENTORY)));


        GameRegistry.addSmelting(blocks.get(0), new ItemStack(items.get(0)),1.5f);

    }

    @EventHandler
    public void init(FMLInitializationEvent event) {
        logger.info("Mod initlialised :" + NAME);
        GameRegistry.registerWorldGenerator(new CumWorldGenerator(),0);
    }

    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {

    }

    public void registerBlock(Block b){
        ForgeRegistries.BLOCKS.register(b);
        ItemBlock itemBlock = new ItemBlock(b);
        itemBlock.setRegistryName(b.getRegistryName());
        itemBlock.setUnlocalizedName(((EatingmachineBlock) b).getName());
        ForgeRegistries.ITEMS.register(itemBlock);
        ModelResourceLocation chinaModelResourceLocation = new ModelResourceLocation(MODID + ":" + ((EatingmachineBlock) b).getName(), RESOURCE_INVENTORY);
        final int DEFAULT_ITEM_SUBTYPE = 0;
        ModelLoader.setCustomModelResourceLocation(itemBlock, DEFAULT_ITEM_SUBTYPE, chinaModelResourceLocation);


    }

}

 

Link to comment
Share on other sites

Ok, so, not only is 1.12 no longer supported, you aren't even registering things right. As it hasn't really changed (until a new thing in 1.15), I'm happy to give you this link.

https://mcforge.readthedocs.io/en/1.12.x/concepts/registries/#registering-things

 

But no further support will be offered to versions below 1.14

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.