简体   繁体   English

Minecraft Forge Mod 方块不显示

[英]Minecraft Forge Mod blocks not showing

I programmed 2 blocks in minecraft forge (I did everything right, I checked it on 4 tutorials).我在 minecraft forge 中编写了 2 个块(我做的一切都正确,我在 4 个教程中检查了它)。 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 .控制台没有给我任何错误: http : //pastebin.com/G5qnz9nT

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

Why are my blocks not there?为什么我的块不存在?

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您使用的是什么版本的 fml,如果它是 1.11,则在为块设置内容时不使用 this.anything()

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 “tabALLSearch”也不是有效的选项卡名称,有一个名为“SEARCH”的选项卡名称,但这意味着如果您希望它在构建块下,它只会在您搜索它时显示,请执行此操作

setCreativeTab(CreativeTabs.BUILDING_BLOCKS);

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".无法在选项卡中看到我的方块,甚至命令“/give playername @mymod:myblock 1”返回“没有名为@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" }
      }
    }
  ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM