我的世界纹理1 11项(或子项)渲染

时间:2017-06-25 14:38:08

标签: textures minecraft

我在Minecraft 1 11中遇到纹理问题 我用子项目创建了Hammer类:

public Hammer(Hammers hammers){
    this(hammers.name, hammers.size, hammers.material);
}
public Hammer(String name, Size range, Item.ToolMaterial material){
    super(name, material);
    this._range = range;
    this.name = name;
    setUnlocalizedName(name);
    setRegistryName(name);
    setCreativeTab(BookCraft.toolTab);
    hasSubtypes = true;
    this.efficiencyOnProperMaterial /= MathHelper.sqrt(_range.width*_range.height);
}
@Override
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
    for (Hammers h : Hammers.values()){
        subItems.add(new ItemStack(new Hammer(h)));
    }
}
public static enum Hammers{
    BUILDER_HAMMER("BuilderHammer", new Size(2,1), ToolMaterial.STONE),
    LIGHT_HAMMER("LightHammer", new Size(2,2), ToolMaterial.IRON),
    MJÖLLNIR("Mjöllnir", new Size(3,2), ToolMaterial.DIAMOND),
    WAR_HAMMER("WarHammer", new Size(2,1), ToolMaterial.DIAMOND),
    LEGENDARY_HAMMER("LegendaryHammer", new Size(5,3), ToolMaterial.DIAMOND);

    public final String name;
    public final Size size;
    public final ToolMaterial material;
    public final float damage;

    Hammers(String name, Size size, ToolMaterial material){
        this.name = name;
        this.size = size;
        this.material = material;
        this.damage = material.getDamageVsEntity();
    }
}

这是ItemInit类,我在其中注册带纹理的项目:

//region Fields
public static Hammer hammes;
//public static Boers boer;
//public static BkAxe axe;
//endregion

//
public static void init(){

    hammes = register(new Hammer(Hammer.Hammers.BUILDER_HAMMER));
    //boer = register(new Boers("boer", new Size(5,3), Item.ToolMaterial.DIAMOND));
    //axe = register(new BkAxe("axe", Item.ToolMaterial.DIAMOND, 7, 7,1000,20));
}

//region Helping Method
private static <T extends Item> T register(T item) {
    GameRegistry.register(item);

    if (item instanceof IBkBase) {
        if (item.getHasSubtypes()){
            item = registerWithSubtypes(item);
        }
        else
            ((IBkBase) item).registerItemModel();
    }

    return item;
}

public static <T extends Item> T registerWithSubtypes(T item){

    NonNullList<ItemStack> items = NonNullList.create();
    item.getSubItems(item, item.getCreativeTab(), items);

    for (int i = 0; i < items.size(); i++){
        Item tempItem = items.get(i).getItem();
            String name = tempItem.getUnlocalizedName().substring(5);
            ModelLoader.setCustomModelResourceLocation(tempItem, i,
                    new ModelResourceLocation(BookCraft.MOD_ID + ":" + name, "inventory"));
        }
    return item;
}
//endregion

所有文件夹都已正确命名,在整个互联网上搜索,无法找到任何帮助

以下是一些截图:

  • 调试信息 Debug info
  • 该项目位于“广告素材”标签中,并显示名称 The item is in the Creative Tab and the name is shown
  • 该项目在世界中的呈现方式 How the item is rendered in the world
  • model文件夹

    The <code>model</code> folder

所有三个* .json都有相同的文字:

{
  "parent": "item/handheld",
  "textures": {
    "layer0": "bk:items/Hammer1"
  }
}

你能建议任何解决方案吗?

1 个答案:

答案 0 :(得分:1)

资源路径&#34; bk:items / Hammer1&#34;与实际路径不符,&#34; bk / models / item / baseHammer&#34;


项目
项目
项目

此外,您的资源文件名称必须全部为小写(&#34; hammer1&#34;或&#34; basehammer&#34;),因为游戏会自动接受您提供的任何内容(例如&#34; Hammer1&#34;)并在其上调用gcloud,如果无法找到具有该确切名称的文件,则会抛出错误(例如&#34; Hammer1.json&#34;不匹配)。< / p>

你需要使用&#34; bk:items / hammer1&#34;并重命名你的&#34;项目&#34;目录到&#34;项目&#34;以及将json文件重命名为&#34; hammer1.json&#34;或&#34; builderhammer&#34; (无论您在注册时实际给出的名称)。