Minecraft Forge 1.8 - 加载块纹理 [英] Minecraft Forge 1.8 - Loading Block Textures

查看:198
本文介绍了Minecraft Forge 1.8 - 加载块纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习Java,同时修改了Minecraft。我已经看过一个关于使用Minecraft Forge API将块添加到游戏中的教程,但我遇到了问题。不再有.setBlockTextureName()方法,所以我不知道该怎么做。我在游戏中添加了一个简单的块,但它没有纹理,我想为它添加纹理。我如何为Minecraft 1.8做这个?

I have just started learning Java while modding Minecraft. I have watched a tutorial on adding the blocks into the game using the Minecraft Forge API, but I have a problem. There is no longer the ".setBlockTextureName ()" method, so I don't know what to do. I have a simple block added into my game, but it has no texture and I want to add a texture to it. How would I do this for Minecraft 1.8?

PS:如果这是重复的,我很抱歉,我只看到有关Minecraft怪物的问题,而不是1.8的纹理问题(请记住,Forge API for 1.8与其他版本不同),所以我决定问自己。

P.S.: If this is a duplicate, I am sorry, I only saw questions about Minecraft mobs, not textures for 1.8 (keep that in mind, the Forge API for 1.8 is different than every other version), so I decided to ask myself.

如果我需要澄清任何事情,请告诉我!

If I need to clarify anything, please, let me know!

推荐答案

纹理在1.8中有很大不同。以下是一些教程:

Texturing is very different in 1.8. Here are some tutorials:

更新块;

更新项目

对于以上两种情况:


  • 从main mod类中删除任何 GameRegistry.registerBlock 。这些现在应该在block / item的构造函数中。

  • 添加私有最终 name 字段并为其创建一个getter。

  • Remove any GameRegistry.registerBlock from the main mod class. These should now be in the block/item's constructor.
  • Add a private final name field and create a getter for it.

对于


  • src / main / resources / assets / {MODID} / models / block 中,您将需要2个JSON文件。

    第一个应该被称为 {BLOCKNAME} .json 并包含:

  • In src/main/resources/assets/{MODID}/models/block you will need 2 JSON files.
    The first should be called {BLOCKNAME}.json and contain this:

{
    "parent": "block/cube_all",
    "textures": {
        "all": "{MODID}:blocks/{BLOCKNAME}"
    }
}

第二个是相同的名称,进入 src / main / resources / assets / {MODID} / models / item ,并且具有以下代码:

The second has the same name, goes in src/main/resources/assets/{MODID}/models/item, and has this code:

{
    "parent": "{MODID}:block/{BLOCKNAME}",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}


  • 现在在 src / main / resources / assets / {MODID} / blockstates 中,您还需要1个JSON文件。使用相同的名称,它应该保留此代码:

  • Now in src/main/resources/assets/{MODID}/blockstates, you need 1 more JSON file. With the same name, it should hold this code:

    {
        "variants": {
            "normal": { "model": "{MODID}:{BLOCKNAME}" }
        }
    }
    


  • 您应该替换 {MODID} {BLOCKNAME} 分别带有你的mod的ID和块名。

    You should replace {MODID} and {BLOCKNAME} with your mod's ID and block's name, respectively.

    这篇关于Minecraft Forge 1.8 - 加载块纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆