Minecraft Forge Mod块没有显示

时间:2016-12-25 11:13:27

标签: java minecraft minecraft-forge forge mod

我在minecraft forge编程了2个块(我做了一切正确,我在4个教程中检查了它)。 当我尝试运行游戏时,块不在广告素材库存中。 控制台没有给我任何错误:http://pastebin.com/G5qnz9nT

我的代码: http://pastebin.com/cq4MvwH9

为什么我的积木不存在?

2 个答案:

答案 0 :(得分:2)

你使用的是哪个版本的fml,如果它的1.11你不使用this.anything() 当为块设置东西时,它只是

setCreativeTab(CreativeTabs.TabName);

也" tabALLSearch"不是有效的标签名称,标签名称为" SEARCH" 但是这意味着它只会在你想要它在搜索构建块的情况下搜索它时才会显示

setCreativeTab(CreativeTabs.BUILDING_BLOCKS);

答案 1 :(得分:0)

我有同样的问题。在选项卡中看不到我的方块,甚至命令“ / give playername @mymod:myblock 1”返回“没有这样的物品,名称为@mymod:myblock”。

有我的主要mod类代码:

@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)
    {
    }
} 

并阻止班级:

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");

    }
}

阻止状态:

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

最后封锁模型:

{
  "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" }
      }
    }
  ]
}