Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Forging a Minecraft mod

Basic Minecraft modding with Minecraft Forge

Help needed

  • 2013-09-04 16:48:07
    hey guys, i have been wondering, how does one render block texture for each side separately ? also, i am having problems understanding metadata.

    Thanks in advance
  • 2013-09-04 16:55:27
    First you need to register all the icons (texture of the side) that you are going to use in here
    public void registerIcons(IconRegister register) { ... }

    then you use this
    public Icon getIcon(int side, int metadata) { }

    that returns the icon that you want to be rendered on that side and with that metadata.

    What's the metadata? It's a 4 bit number (from 0 to 15) that is memorized with any blocks and adds more information to that block so that you don't need to use different block ids for blocks that has the same behaviour. Ex: the different types of wool.
  • 2013-09-04 16:57:48
    By the way I think you should use less generic titles so that one can know what this topic is about without reading everything :)
  • 2013-09-04 21:44:14
    Just browsing the forums but I just wanted to say, great explanation, Frod! I haven't gotten to Forging a Minecraft Mod yet but I will soon, and I'm sure your explanation here will be useful when I do. Thanks :)
  • 2013-09-05 04:46:38
    By the way, for the int side in
    public Icon getIcon(int side, int metadata) { }

    0 is bottom, 1 is top and 2, 3, 4, 5 is the sides. so you can do something like this:

    public Icon getIcon(int side, int meta) {
        if (side == 0) {
            return bottomIcon;
        }else if(side == 1) {
            return topIcon;
        }else{
            return sideIcon;
        }
    }

    Of course, this is the most basic thing you can do with it. You can make it display different textures based on its metadata if you want. All this is mentioned in the lecture I think. There is also getBlockTexture(IBlockAccess world, int x, int y, int z, int side) which you can use if you want to use data from tileentity as well.
  • 2013-09-05 06:04:48
    Hey Frod and Noob, thx for replying, really help me understand alot better
  • Log in or sign up to reply to this thread