Skip to content

The Block File

The Ghost in the Machine edited this page Dec 13, 2017 · 3 revisions

Each block in Terasology needs a .block file. This file defines certain things that cannot be defined in the java file. For an in depth explanation of .block file attributes, see this. Here, we are only concerned about the custom sections that we made with the annotation at the top of our block family class's header. Here's the block file that we'll be using:

{
    "displayName": "Arrow Block",
    "hardness": 3,
    "tiles" : {
        "topBottom" : "top",
        "sides" : "side"
    },
    "shape": "engine:cube",
    "family": "arrow",
    "no_connections": {
	    "tiles": {
	        "topBottom": "top"
	    }
    },
    "left_end": {
    	"tiles": {
	        "topBottom": "left_end"
    	}
    },
    "right_end": {
    	"tiles": {
	        "topBottom": "right_end"
    	}
    },
    "front_end": {
	    "tiles": {
	        "topBottom": "front_end"
	    }
    },
    "back_end": {
    	"tiles": {
    		"topBottom": "back_end"
    	}
    },
    "2d_corner": {
    	"tiles": {
    		"topBottom": "corner"
    	}
    },
    "2d_t": {
    	"tiles": {
    		"topBottom": "t_shape"
    	}
    },
    "cross": {
    	"tiles": {
    		"topBottom": "cross"
    	}
    }
}

The sections we made are the ones with names like "back_end" and "front_end". All We do here is just override the top tile for each permutation to be the one we want. Notice the "family" tag, it's value, "arrow" is the same string the we used in the annotation @RegisterBlockFamily("arrow"). That is very important as it is what links the .block file to the java file we made.

Clone this wiki locally