User Tools

Site Tools


**This is an old revision of the document!**


The Voxel.class is user-extendable and provides a way for users to define custom behaviours for their voxels. It takes into argument a 'type' variable, that contains the properties defined in the .voxels file

package demo.voxel
import io.xol.chunkstories.api.voxel.Voxel;

public class MyVoxelType extends Voxel
    int configured;

    public MyVoxelType(VoxelType type)
        //We can use the type variable to access stuff defined in the voxel file definition
        configured = Integer.parseInt(type.resolveProperty("some_value_we_need", "0"));
    //Custom behaviour goes here

Reminder : to tell the game to use a custom voxel class for a certain id, you have to write

voxel myVoxel 666
	customClass: demo.voxel.MyVoxelType

in your .voxels file.

voxel.class.1486974192.txt.gz · Last modified: 2017/02/13 09:23 by gobrosse