User Tools

Site Tools


voxel.class

CustomClass::Voxel.class

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)
    {
	super(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"));
    }
    
    @Override
    //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.txt · Last modified: 2017/02/13 10:11 by gobrosse