我正在尝试自学 Java 语法并使用 minecraft 作为潜水平台。但我遇到了问题,因为我的纹理都没有被加载。就此而言,我的本地化也不是。这是我的块的代码
package net.richbaird.testtutorial.blocks;
import cpw.mods.fml.common.registry.GameRegistry;
//import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.richbaird.testtutorial.lib.constants;
public class OrangeBlock extends Block {
private String blockName = "orangeBlock";
public OrangeBlock() {
super(Material.rock);
this.setBlockName(constants.MODID + "_" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
GameRegistry.registerBlock(this,blockName);
this.setBlockTextureName(constants.MODID + ":" + blockName);
//LanguageRegistry.addName(this,"tutorial block");
}
}
这是我的常量类
package net.richbaird.testtutorial.lib;
public class constants {
public static final String MODID = "testtutorial";
public static final String MODNAME = "Test Tutorial";
public static final String VERSION = "1.0";
}
我的纹理保存在
~/IdeaProjects/testmod/src/main/resources/assets/testtutorial/textures/blocks/orangeBlock.png
根据日志,它无法找到我的纹理。这是我收到的信息
[08:08:14] [Client thread/ERROR]:
Using missing texture, unable to load
testtutorial:textures/blocks/orangeBlock.png
java.io.FileNotFoundException: testtutorial:textures/blocks/orangeBlock.png
客户端加载并显示我的项目,但具有默认的黑色和紫色纹理。我做错了什么?我认为这可能与我的命名约定有关,因为 .lang 文件也永远不会被读取,而我可以给我的块起一个友好名称的唯一方法是使用现在已弃用的LanguageRegistry.addName()
方法