14

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?

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!

3
  • 2
    Can I suggest using 1.7 instead? 1.8 seems to have a lot of problems at the moment, and most people playing modded Minecraft are playing 1.7 anyway. Commented Jan 24, 2015 at 0:59
  • 2
    Version 1.8 is relatively new, I would also suggest using 1.7 version until a more stable version of forge comes out. Commented Jan 24, 2015 at 1:03
  • 2
    Well, I suppose I could. I mean, 1.8 does really, mainly, add blocks. I guess I will go to 1.7 again, but knowing how to mod 1.8 would be nice. Commented Jan 24, 2015 at 1:33

2 Answers 2

23
+500

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.

Sign up to request clarification or add additional context in comments.

Comments

0

I recommend reading Minecraft Modding

The way that Minecraft renders blocks has changed significantly for 1.8. Previously, the shape of blocks was defined in the java code. This meant that (for example) a BlockTorch would always have the same shape, and only the textures could be changed. Minecraft now uses model files to define both the shape and the texture.

in particular "Some Clarifications of some of the key points" on the above page.

See also: Block models

1 Comment

I have moved to making a game with a team now. :) Thanks though, I have been thinking of making a Minecraft mod for fun for a while now lol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.