Minecraft Forge 1.8 - Loading Block Textures

后端 未结 2 1210
挽巷
挽巷 2021-02-07 13:09

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. Ther

2条回答
  •  不思量自难忘°
    2021-02-07 13:56

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

    Updating Blocks;
    Updating Items.

    For both of the above:

    • 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.

    For blocks:

    • 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}"
          }
      }
      

      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 ]
              }
          }
      }
      
    • 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}" }
          }
      }
      

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

提交回复
热议问题