Class BlockSounds
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
A set of sounds that are defined for a block. All fields use default or empty sounds if not set. Open in GitHub
[DocumentAsJson]
public class BlockSounds
- Inheritance
-
BlockSounds
- Inherited Members
- Extension Methods
Examples
"sounds": {
"place": "block/dirt",
"break": "block/dirt",
"hit": "block/dirt",
"walk": "walk/grass"
},
Fields
Ambient
Played in ambience for this block.
[DocumentAsJson("Optional", "None", false)]
public AssetLocation? Ambient
Field Value
AmbientBlockCount
Amount of nearby ambient sound blocks in order to reach full ambient sound volume
[DocumentAsJson("Optional", "10", false)]
public float AmbientBlockCount
Field Value
AmbientMaxDistanceMerge
Adjacent ambient sound sources are merged to avoid playing too many sounds too loudly. This is the maximum distance a sound source can be from another to allow a merge.
[DocumentAsJson("Optional", "3", false)]
public float AmbientMaxDistanceMerge
Field Value
AmbientSoundType
The type of sound for this block's ambient sound.
[DocumentAsJson("Optional", "Ambient", false)]
public EnumSoundType AmbientSoundType
Field Value
Properties
Break
Played when this block is broken.
[DocumentAsJson("Optional", "See game/soundconfig.json. Range defaults to 16.", false)]
[JsonConverter(typeof(SoundAttributeConverter), new object[] { true, 16 })]
public virtual SoundAttributes Break { get; set; }
Property Value
ByTool
Gets the sound that occurs when a specific tool hits a block. (Note for coders: if none specified in the JSON, this will be null from version 1.20.4 onwards)
[DocumentAsJson("Optional", "None", false)]
public virtual Dictionary<EnumTool, BlockSounds>? ByTool { get; set; }
Property Value
Hit
Played when this block is hit. Will be overridden by ByTool if an appropriate tool is set.
[DocumentAsJson("Optional", "See game/soundconfig.json. Range defaults to 16.", false)]
[JsonConverter(typeof(SoundAttributeConverter), new object[] { true, 16 })]
public virtual SoundAttributes Hit { get; set; }
Property Value
Inside
Played when an entity moves inside this block. Primarily used for liquids and foliage.
[DocumentAsJson("Optional", "None. Range defaults to 12.", false)]
[JsonConverter(typeof(SoundAttributeConverter), new object[] { true, 12 })]
public virtual SoundAttributes Inside { get; set; }
Property Value
Place
Played when this block is placed.
[DocumentAsJson("Optional", "See game/soundconfig.json. Range defaults to 16.", false)]
[JsonConverter(typeof(SoundAttributeConverter), new object[] { true, 16 })]
public virtual SoundAttributes Place { get; set; }
Property Value
Walk
Played when an entity walks on this block.
[DocumentAsJson("Optional", "See game/soundconfig.json. Range defaults to 12.", false)]
[JsonConverter(typeof(SoundAttributeConverter), new object[] { true, 12 })]
public virtual SoundAttributes Walk { get; set; }
Property Value
Methods
Clone()
Clones the block sounds.
public BlockSounds Clone()
Returns
GetBreakSound(EnumTool)
Gets the break sound either by the tool or by the block if the tool does not have a break sound.
public SoundAttributes GetBreakSound(EnumTool tool)
Parameters
toolEnumToolThe Tool used.
Returns
- SoundAttributes
The resulting sound
GetBreakSound(IPlayer?)
Gets the breaking sound, either provided by the tool or by this sound.
public SoundAttributes GetBreakSound(IPlayer? byPlayer)
Parameters
byPlayerIPlayer
Returns
GetHitSound(EnumTool)
Gets the hit sound either by the tool or by the block if the tool does not have a hit sound.
public SoundAttributes GetHitSound(EnumTool tool)
Parameters
toolEnumTool
Returns
GetHitSound(IPlayer?)
Gets the hit sound either provided by the tool or by the block.
public SoundAttributes GetHitSound(IPlayer? byPlayer)
Parameters
byPlayerIPlayer
Returns
OnDeserializedMethod(StreamingContext)
[OnDeserialized]
public void OnDeserializedMethod(StreamingContext context)
Parameters
contextStreamingContext