Minecraft 1.7.2有效设置纹理



我在每个单独的文件中设置纹理,这是一种低效的设置方法

this.setUnlocalizedName("ItemName");
this.setTextureName("MyModName:ItemName");

这种方式对我来说是有意义的,但行不通:

this.setUnlocalizedName("ItemName");
this.setTextureName(OtherClassName.MODID + ":" + this.getUnlocalizedName());

"OtherClassName。MODID'引用了另一个类中包含'MyModName'的变量this.getUnlocalizedName()获取已声明的UnlocalizedName, 'ItemName'

帮忙吗?我不知道为什么它不起作用。

getUnlocalizedName有点奇怪-它返回您传递给setUnlocalizedName的字符串,但以"item."开头。使用去混淆代码的乐趣…

可以:

String name = "ItemName";
this.setUnlocalizedName(name);
this.setTextureName(OtherClassName.MODID + ":" + name);

请注意,它不是更高效,在运行更快,但它可能会更快,如果你改变项目名称很多。

最新更新