-
Notifications
You must be signed in to change notification settings - Fork 46
Block Physics Properties
Sable stores physics-related properties per block-state. These properties are defined through definition JSONs in datapacks.
The default available properties consist of:
-
sable:mass- mass of the block inkpg. Default1.0 -
sable:inertia- inertia multiplier of the block along each axis inkpg*m^2. Is multiplied by the mass of the block before usage. Default[1/6, 1/6, 1/6] -
sable:volume- the volume of the block inm^3. Used for buoyancy calculations. Default1.0 -
sable:restitution- the bounciness of the block from 0-1. Default0.0 -
sable:friction- the friction multiplier of the block. Default1.0 -
sable:fragile- if the block should break upon impact. Defaultfalse -
sable:floating_material- the floating block material to assign. Defaultnull -
sable:floating_scale- the multiplier for the floating block material. Default1.0
Block physics property definition JSONs can be put in any datapack under the physics_block_properties folder.
// /data/examplemod/physics_block_properties/example_block.json
{
// The selector can either be a tag, or block ID.
// If a tag is used, all blocks in the tag will be effected.
// Ex. `#examplemod:example_blocks` or `examplemod:example_block`
"selector": "examplemod:example_block"
// Priority is default 1000.
// Definitions are applied in order of ascending priority
"priority": 1001,
"properties": {
// Any properties can be defined here
"sable:mass": 2.0
},
"overrides": {
// Override keys are block-state conditions
"lit=true": {
// Any properties can be defined here
// All block-states meeting the condition will be affected
"sable:mass": 3.0
}
}
}A block that bounces:
// /data/examplemod/physics_block_properties/bouncy_block.json
{
"selector": "examplemod:bouncy_block",
"properties": {
"sable:restitution": 0.5
}
}A piston that doesn't weigh as much when extended:
// /data/examplemod/physics_block_properties/piston.json
{
"selector": "examplemod:piston",
"properties": {
"sable:mass": 1.0
},
"overrides": {
"extended=true": {
"sable:mass": 0.5
}
}
}Sable contains many block tags in its own built-in datapack for commonly used physics block properties. It is suggested to put your block into the pre-defined tags, if you do not need custom property definitions:
-
#sable:super_lightmass = 0.25 -
#sable:lightmass = 0.5 -
#sable:heavymass = 2.0 -
#sable:super_heavymass = 4.0 -
#sable:half_volumevolume = 0.5 -
#sable:quarter_volumevolume = 0.25 -
#sable:slipperyfriction = 0.0 -
#sable:bouncyrestitution = 0.5