User Tools

Site Tools


voxels_format

Modding::Voxels

Voxels definitions are stored in the voxels/ directory. They are loaded after the Items definitions, and in order from lowest-priority mod to highest-priority mod, with the 'core' base content always being the lowest priority mod.

The voxels definitions files use the NamedWithProperties file format.

Example : testVoxelDefinitions.def

/** Excerpts from multiple vanilla definition files in chunkstories-core */
voxel hard_sand {
}

voxel cobble {
	material: stone
}

voxel cactus {
	textures {
		sides: ~side
		top: ~top
	}
	hardness: 0.8
}

voxel flower_red {
	solid: false
	opaque: false
	representation {
		model: ./voxels/models/grass.obj
	}
}

Built-in configurable properties

These properties are resolved by Voxel.java when reading your definition, using those you can tweak the behavior of the voxel without resorting to writing a custom class.

Property Type/Range Description
solid Boolean Is this voxel solid in the physics engine sense
opaque Boolean Is this voxel 'full' and so blocks lights and cull neighbours ?
selfOpaque Boolean If this voxel is not “opaque”, does it connects with others voxels of the same type ? (ie glass or water)
material String References the VoxelMaterial used by this voxel type
emittedLightLevel Int in 0..15 The light level the block emmits
shadingLightLevel Int in 0..15 How much, on top of the normal attenuation, does the light level of light passing through this block is reduced
texture String Sets the texture used by this voxel, by default it just looks for the voxel name instead. For more information check out the page on Voxel textures.
textures Compound property Define each side's texture independently.
collisionBox Parameters for a Box() Defines the collision box for this voxel. To have voxels with more than one collision box, you have to use a custom class.
class String If provided, the game will try to use a custom class for this voxel.

The voxels/textures folder

WIP / Deprecated

Contains textures for the voxels. Accessed by their name in the code/.voxels files. The normal/ folder contain the normal-mapped versions of the textures, if not provided the game uses a flat default normal map. The meta.txt contains informations about the scale and whatnot of the textures :

texture smoothstone {
	textureScale: 2
}

texture sand2 {
	textureScale: 4
}

The voxels textures in those folders are merged in a texture atlas before usage.

voxels_format.txt · Last modified: 2018/09/10 12:04 by gobrosse