Minecraft Forge Mod blocks not showing

2k views Asked by At

I programmed 2 blocks in minecraft forge (I did everything right, I checked it on 4 tutorials). When I try to run the game the blocks are not in the creative inventory. The console gives me no error: http://pastebin.com/G5qnz9nT.

My code: http://pastebin.com/cq4MvwH9

Why are my blocks not there?

2

There are 2 answers

3
Gannon Burks On

what version of fml are you using and if its 1.11 you dont use this.anything() when setting things for the block it would just be

setCreativeTab(CreativeTabs.TabName);

also "tabALLSearch" isn't a valid tab name there is a tab name called "SEARCH" but that means it only shows up if you search it if you want it to be under building blocks do this

setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
0
MikaAll On

I have the same problem. Can`t see my block in tabs , and even command "/give playername @mymod:myblock 1" returns "There is no such item with name @mymod:myblock".

There is my main mod class code:

@Mod.EventBusSubscriber
@Mod(modid = NoFear.MODID, name = NoFear.NAME, version = NoFear.VERSION)
public class NoFear
{
    public static final String MODID = "nofear";
    public static final String NAME = "No fear";
    public static final String VERSION = "1.0";

    private static Logger logger;

    @EventHandler
    public void preLoad(FMLPreInitializationEvent event)
    {
        logger = event.getModLog();
        logger.info("PRELOAD");

    }

    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event) {
        event.getRegistry().register(new BlockTigerMuzzle());
    }


    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    }

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    }
} 

and block`s class:

public class BlockTigerMuzzle extends Block {

    public BlockTigerMuzzle() {
        super(Material.IRON);
        this.setRegistryName("nofear","tigermuzzle");
        this.setCreativeTab(CreativeTabs.SEARCH);
        this.setHardness(15F);
        this.setResistance(10F);
        this.setHarvestLevel("pickaxe", 3);
        this.setLightLevel(0F);
        this.setUnlocalizedName("Tiger muzzle");

    }
}

blockstates:

{
  "forge_marker": 1,
  "variants": {
    "normal": {
      "model": "nofear:tigermuzzle"
    },
    "inventory": {
      "model": "nofear:tigermuzzle",
      "transform": "forge:default-block"
    }
  }
}

and finally block`s model:

{
  "ambientocclusion": false,
  "textures": {
    "muzzle": "nofear:blocks/tigermuzzle"
  },
  "elements": [
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "texture": "#muzzle", "cullface": "down" },
        "up":    { "texture": "#muzzle", "cullface": "up" },
        "north": { "texture": "#muzzle", "cullface": "north" },
        "south": { "texture": "#muzzle", "cullface": "south" },
        "west":  { "texture": "#muzzle", "cullface": "west" },
        "east":  { "texture": "#muzzle", "cullface": "east" }
      }
    }
  ]
}