[英]Minecraft Forge Mod blocks not showing
我在 minecraft forge 中编写了 2 个块(我做的一切都正确,我在 4 个教程中检查了它)。 当我尝试运行游戏时,块不在创意清单中。 控制台没有给我任何错误: http : //pastebin.com/G5qnz9nT 。
我的代码: http : //pastebin.com/cq4MvwH9
为什么我的块不存在?
您使用的是什么版本的 fml,如果它是 1.11,则在为块设置内容时不使用 this.anything()
setCreativeTab(CreativeTabs.TabName);
“tabALLSearch”也不是有效的选项卡名称,有一个名为“SEARCH”的选项卡名称,但这意味着如果您希望它在构建块下,它只会在您搜索它时显示,请执行此操作
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
我也有同样的问题。 无法在选项卡中看到我的方块,甚至命令“/give playername @mymod:myblock 1”返回“没有名为@mymod:myblock 的项目”。
有我的主要模组类代码:
@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" }
}
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.