Modding:Json Block Behaviors: Difference between revisions
From Vintage Story Wiki
Lazy Warlock (talk | contribs) |
(→All Block Behaviors: Add a link to the collectible behaviors) |
||
(21 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== Adding behaviors to your block == | == Adding behaviors to your block == | ||
Block behaviors are an array of objects with properties attached to your block. | Block behaviors are an array of objects with properties attached to your block. They are added through the <code>behaviors</code> field at the top level (same level as the <code>code</code> field) of a block json file. | ||
Below is an example of two behaviors, one with properties and one without properties. | Below is an example of two behaviors, one with properties and one without properties. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | |||
... | |||
code: "exampleblock", | |||
... | |||
behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}], | behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}], | ||
... | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Additionally, [[Modding:Block_Entity_Behaviors|block entity behaviors]] can be added in the '''entityBehaviors''' field, although they are used less often. | |||
== All Block Behaviors == | == All Block Behaviors == | ||
Here is a table containing all properties of the base game as of 1. | Here is a table containing all properties of the base game as of 1.18.14. Collectible behaviors can also be added to blocks; they are listed [[Modding:Collectible_Behaviors|separately]]. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Behavior Name ! | ! Behavior Name | ||
! style="width: 25em" | Properties | |||
! Used by Blocks | |||
|- | |- | ||
| | | [[Json_block_behaviors_BlockEntityInteract|BlockEntityInteract]] || - || door | ||
|- | |- | ||
| | | [[Json_block_behaviors_BreakIfFloating|BreakIfFloating]] || - || termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog | ||
|- | |- | ||
| | | [[Json_block_behaviors_BreakSnowFirst|BreakSnowFirst]] || - || tallgrass, stonepath | ||
|- | |- | ||
| [[Json_block_behaviors_CanAttach|CanAttach]] | |||
| | |||
* sides | |||
| drystonefence, woodenfence, roughhewnfence | |||
|- | |- | ||
| | | [[Json_block_behaviors_CanIgnite|CanIgnite]] || - || torch | ||
|- | |- | ||
| | | [[Json_block_behaviors_CollectFromThis|CollectFrom]] || - || henbox | ||
|- | |- | ||
| | | [[Json_block_behaviors_Container|Container]] || - || storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket | ||
|- | |- | ||
| [[Json_block_behaviors_Decor|Decor]] | |||
| | |||
* sides | |||
* sidedVariants | |||
* nwOrientable | |||
* drawIfCulled | |||
* alternateZOffset | |||
* notFullFace | |||
* removable | |||
* thickness | |||
| linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart | |||
|- | |- | ||
| | | [[Json_block_behaviors_Door|Door]] || - || door | ||
|- | |- | ||
| | | [[Json_block_behaviors_DropNotSnowCovered|DropNotSnowCovered]] || - || fern, flower | ||
|- | |- | ||
| [[Json_block_behaviors_ExchangeOnInteract|ExchangeOnInteract]] | |||
| | |||
* exchangeStates (string array of block states) | |||
* sounds (path from sounds folder) | |||
* actionLangCode (language key from the lang file) | |||
| trapdoor | |||
|- | |- | ||
| | | [[Json_block_behaviors_FiniteSpreadingLiquid|FiniteSpreadingLiquid]] | ||
| | |||
* liquidCollisionSound (path from sounds folder) | |||
* sourceReplacementCode (block code) | |||
* flowingReplacementCode (block code) | |||
* collidesWith (other liquid) | |||
* spreadDelay (int, default: 0) | |||
| boilingwater, water, lava, saltwater | |||
|- | |- | ||
| [[Json_block_behaviors_Harvestable|Harvestable]] | |||
| | |||
* harvestTime (float, seconds, default: 0) | |||
* harvestedStack (BlockDropItemStack) | |||
* harvestingSound (path from sounds folder) | |||
* harvestedBlockCode (block code) | |||
| bigberrybush, saguarocactus, smallberrybush, log-resin | |||
|- | |- | ||
| [[Json_block_behaviors_HeatSource|HeatSource]] | |||
| | |||
* heatStrength (float) | |||
| boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire | |||
|- | |- | ||
| | | [[Json_block_behaviors_horizontalattachable|HorizontalAttachable]] | ||
| | |||
* handleDrops (bool, default: true) | |||
* dropBlockFace (Compass Direction, default: "north") | |||
* dropBlock (block name) | |||
* attachmentAreas (side -> RotatableCube) | |||
* attachmentArea (cuboid) | |||
| tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack | |||
|- | |- | ||
| | | [[Modding:HorizontalOrientable_behavior|HorizontalOrientable]] | ||
| | |||
* dropBlockFace (Compass Direction, default: "North") | |||
* drop (block or item name) | |||
| agedwallpaperplanks, altar, bellows, bloomerybase, brake, cage, churn, clayoven, clutch, cokeovendoor, condenser, crank, creativerotor, helvehammerbase, jonas, labeledchest, metalpartpile, palisadestakes, palisadewall, pulverizerframe, resonator, skep, slantedroofing, slantedroofingcornerinner, slantedroofingcornerouter, statictranslocator, stationarybasket, stonecoffinsection, stove, trunk, verticalboiler, wagonwheels, windmillrotor, workbench | |||
|- | |- | ||
| | | [[Json_block_behaviors_HorizontalUpDownOrientable|HorizontalUpDownOrientable]] || - || - | ||
|- | |- | ||
| | | [[Json_block_behaviors_ignitable|Ignitable]] || - || charcoalpit, clayoven, firepit | ||
|- | |- | ||
| | | [[Json_block_behaviors_JonasBoilerDoor|JonasBoilerDoor]] || - || jonas | ||
|- | |- | ||
| | | [[Json_block_behaviors_JonasGasifier|JonasGasifier]] || - || jonas | ||
|- | |- | ||
| | | [[Json_block_behaviors_JonasHydraulicPump|JonasHydraulicPump]] || - || jonas | ||
|- | |- | ||
| [[Json_block_behaviors_Ladder|Ladder]] | |||
| | |||
* dropBlockFace (face direction, Default: north) | |||
* isFlexible (bool, default: false) | |||
| ladder | |||
|- | |- | ||
| | | [[Json_block_behaviors_Lockable|Lockable]] || - || archimedesscrew, chest, chute, cokeovendoor, crate, door, hopper, irondoor, labeledchest, roughhewnfencegate, stationarybasket, storagevessel, trapdoor, trunk, woodenfencegate | ||
|- | |- | ||
| UnstableFalling || | | [[Json_block_behaviors_MilkingContainer|MilkingContainer]] || - || woodbucket | ||
|- | |||
| [[Json_block_behaviors_Multiblock|Multiblock]] | |||
| | |||
* sizex | |||
* sizey | |||
* sizez | |||
* type | |||
* cposition | |||
| jonas, riftward, verticalboiler, banner, trunk, painting | |||
|- | |||
| [[Json_block_behaviors_MyceliumHost|MyceliumHost]] || - || creativegrass, forestfloor, log, soil | |||
|- | |||
| [[Json_block_behaviors_NoParticles|NoParticles]] || - || claybrickchimney | |||
|- | |||
| [[Json_block_behaviors_NWOrientable|NWOrientable]] || - || bookshelves (legacy), claybrickchimney, fruitpress, fruitpresstop, mannequin, slantedroofingridge, transmission, trough, woodenpath, woodentoggle | |||
|- | |||
| [[Json_block_behaviors_OmniAttachable|OmniAttachable]] | |||
| | |||
* facingCode (string, default: orientation) | |||
* attachmentAreas (side -> RotatableCube) | |||
| crystal, lantern | |||
|- | |||
| [[Json_block_behaviors_OmniRotatable|OmniRotatable]] | |||
| | |||
* rotateH (bool, default: false) | |||
* rotateV (bool, default: false) | |||
* rotateV4 (bool, default: false) | |||
* rotateSides (bool, default: false) | |||
* facing (string, "block" or "player", default: "player") | |||
* dropChance(float, default: 1) | |||
| brickslabs, clayshinglelabs, cobblestoneslab, glassslab, mudbrickslab, plankslab, polishedrockslab, quartzslab, stonebrickslab, trapdoor | |||
|- | |||
| [[Json_block_behaviors_pillar|Pillar]] | |||
| | |||
* invertedPlacement (bool, default: false) | |||
| carvedlog, debarkedlog, hay, log, lognarrow, planks, plaster, quartzpillar, stackedbamboo, woodenaxle | |||
|- | |||
| [[Json_block_behaviors_Pumpkin|Pumpkin]] | |||
| | |||
* vineGrowthStage(int) | |||
* vineGrowthQuantity(NatFloat) | |||
| crop | |||
|- | |||
| [[Json_block_behaviors_PushEventOnBlockBroken|PushEventOnBlockBroken]] | |||
| | |||
* eventName (string) | |||
| bamboo, bambooleaves, leaves, leavesbranchy, leavesnarrow, log, lognarrow, logsection | |||
|- | |||
| [[Json_block_behaviors_RainDrip|RainDrip]] || - || - | |||
|- | |||
| [[Json_block_behaviors_Reinforcable|Reinforcable]] || - || - | |||
|- | |||
| [[Json_block_behaviors_RightClickPickup|RightClickPickup]] | |||
| | |||
* dropsPickupMode (bool, default: false) | |||
* sound (path from sounds folder) | |||
* placeSound (path from sounds folder) | |||
| basereturnteleporter, bowl, bowl-meal, clayplanter, claypot, crock, crucible, egg, flowerpot, ingotmold, jug, lantern, looseflints, looseores, loosestick, loosestones, metal, oillamp, pan, pie, pineapple, pumpkin, seashell, storagevessel, toolmold, wateringcan, woodbucket | |||
|- | |||
| [[Json_block_behaviors_RopeTieable|RopeTieable]] || - || roughhewnfence, woodenfence | |||
|- | |||
| [[Json_block_behaviors_slab|Slab]] || - || - | |||
|- | |||
| [[Json_block_behaviors_Steaming|Steaming]] || - || boilingwater | |||
|- | |||
| [[Json_block_behaviors_SneakPlacing|SneakPlacing]] || - || pan, pie, wateringcan | |||
|- | |||
| [[Json_block_behaviors_Unplaceable|Unplaceable]] || - || bloomerychimney, bowl, bowl-meal, clayplanter, claypot, crock, crucible, flowerpot, ingotmold, jug, metal, pineapple, pumpkin, storagevessel, toolmold, wateringcan | |||
|- | |||
| [[Json_block_behaviors_Unstable|Unstable]] | |||
| | |||
* attachedToFaces (default: down) | |||
* attachmentAreas (side -> RotatableCube) | |||
| bunchocandles, crop, deadcrop, firepit, oreblastingbomb, silvertorchcactus, verticalboiler, wildbeehive, woodenpath, woodenrails | |||
|- | |||
| [[Json_block_behaviors_UnstableFalling|UnstableFalling]] | |||
| | |||
* attachableFaces (string array) | |||
* attachmentArea (cuboid) | |||
* attachmentAreas (side -> RotatableCube) | |||
* ignorePlaceTest (bool, default: false) | |||
* exceptions (block code array) | |||
* fallSideways (bool, default: false) | |||
* dustIntensity (float, default: 0) | |||
* fallSidewaysChance (float, default: 0.3) | |||
* fallSound (path from sounds folder) | |||
* impactDamageMul (float, default 1) | |||
| anvil, anvilpart, barrel, barrelcactus, bloomerychimney, bonyremains, bonysoil, carcass, chair, chandelier, cheese, churn, clayplanter, coalpile, dirtygravel, displaycase, drycarcass, egg, flowerpot, gravel, groundstorage, ingotmold, knappingsurface, lightningrod, looseboulders, looseflints, loosegears, looseores, loosestick, loosestones, lootvessel, metal, metalpartpile, muddygravel, oillamp, omoktabletop, pan, pie, quern, sand, seashell, sieve, sludgygravel, snowlayer, stonecoffinlid, storagevessel, table, talldisplaycase, toolmold, wateringcan, woodbucket | |||
|- | |||
| [[Json_block_behaviors_WrenchOrientable|WrenchOrientable]] | |||
| | |||
* hideInteractionHelpInSurvival (bool, default: false) | |||
* baseCode (string) | |||
| banner, brickslabs, brickstairs, carvedlog, chute, clayshinglelabs, clayshinglestairs, clutter, cobblestoneslab, cobblestonestairs, debarkedlog, glassslab, jonas, log, mudbrickslab, planks, plankslab, plankstairs, plaster, polishedrockslab, quartzpillar, quartzslab, quartzstairs, stonebrickslab, stonebrickstairs, stonepathstairs | |||
|- | |||
| [[Json_block_behaviors_WorldEditFixGhostBlockPlace|WorldEditFixGhostBlockPlace]] || - || - | |||
|} | |} | ||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} |
Latest revision as of 05:36, 27 July 2024
Adding behaviors to your block
Block behaviors are an array of objects with properties attached to your block. They are added through the behaviors
field at the top level (same level as the code
field) of a block json file.
Below is an example of two behaviors, one with properties and one without properties.
{
...
code: "exampleblock",
...
behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}],
...
}
Additionally, block entity behaviors can be added in the entityBehaviors field, although they are used less often.
All Block Behaviors
Here is a table containing all properties of the base game as of 1.18.14. Collectible behaviors can also be added to blocks; they are listed separately.
Behavior Name | Properties | Used by Blocks |
---|---|---|
BlockEntityInteract | - | door |
BreakIfFloating | - | termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog |
BreakSnowFirst | - | tallgrass, stonepath |
CanAttach |
|
drystonefence, woodenfence, roughhewnfence |
CanIgnite | - | torch |
CollectFrom | - | henbox |
Container | - | storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket |
Decor |
|
linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart |
Door | - | door |
DropNotSnowCovered | - | fern, flower |
ExchangeOnInteract |
|
trapdoor |
FiniteSpreadingLiquid |
|
boilingwater, water, lava, saltwater |
Harvestable |
|
bigberrybush, saguarocactus, smallberrybush, log-resin |
HeatSource |
|
boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire |
HorizontalAttachable |
|
tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack |
HorizontalOrientable |
|
agedwallpaperplanks, altar, bellows, bloomerybase, brake, cage, churn, clayoven, clutch, cokeovendoor, condenser, crank, creativerotor, helvehammerbase, jonas, labeledchest, metalpartpile, palisadestakes, palisadewall, pulverizerframe, resonator, skep, slantedroofing, slantedroofingcornerinner, slantedroofingcornerouter, statictranslocator, stationarybasket, stonecoffinsection, stove, trunk, verticalboiler, wagonwheels, windmillrotor, workbench |
HorizontalUpDownOrientable | - | - |
Ignitable | - | charcoalpit, clayoven, firepit |
JonasBoilerDoor | - | jonas |
JonasGasifier | - | jonas |
JonasHydraulicPump | - | jonas |
Ladder |
|
ladder |
Lockable | - | archimedesscrew, chest, chute, cokeovendoor, crate, door, hopper, irondoor, labeledchest, roughhewnfencegate, stationarybasket, storagevessel, trapdoor, trunk, woodenfencegate |
MilkingContainer | - | woodbucket |
Multiblock |
|
jonas, riftward, verticalboiler, banner, trunk, painting |
MyceliumHost | - | creativegrass, forestfloor, log, soil |
NoParticles | - | claybrickchimney |
NWOrientable | - | bookshelves (legacy), claybrickchimney, fruitpress, fruitpresstop, mannequin, slantedroofingridge, transmission, trough, woodenpath, woodentoggle |
OmniAttachable |
|
crystal, lantern |
OmniRotatable |
|
brickslabs, clayshinglelabs, cobblestoneslab, glassslab, mudbrickslab, plankslab, polishedrockslab, quartzslab, stonebrickslab, trapdoor |
Pillar |
|
carvedlog, debarkedlog, hay, log, lognarrow, planks, plaster, quartzpillar, stackedbamboo, woodenaxle |
Pumpkin |
|
crop |
PushEventOnBlockBroken |
|
bamboo, bambooleaves, leaves, leavesbranchy, leavesnarrow, log, lognarrow, logsection |
RainDrip | - | - |
Reinforcable | - | - |
RightClickPickup |
|
basereturnteleporter, bowl, bowl-meal, clayplanter, claypot, crock, crucible, egg, flowerpot, ingotmold, jug, lantern, looseflints, looseores, loosestick, loosestones, metal, oillamp, pan, pie, pineapple, pumpkin, seashell, storagevessel, toolmold, wateringcan, woodbucket |
RopeTieable | - | roughhewnfence, woodenfence |
Slab | - | - |
Steaming | - | boilingwater |
SneakPlacing | - | pan, pie, wateringcan |
Unplaceable | - | bloomerychimney, bowl, bowl-meal, clayplanter, claypot, crock, crucible, flowerpot, ingotmold, jug, metal, pineapple, pumpkin, storagevessel, toolmold, wateringcan |
Unstable |
|
bunchocandles, crop, deadcrop, firepit, oreblastingbomb, silvertorchcactus, verticalboiler, wildbeehive, woodenpath, woodenrails |
UnstableFalling |
|
anvil, anvilpart, barrel, barrelcactus, bloomerychimney, bonyremains, bonysoil, carcass, chair, chandelier, cheese, churn, clayplanter, coalpile, dirtygravel, displaycase, drycarcass, egg, flowerpot, gravel, groundstorage, ingotmold, knappingsurface, lightningrod, looseboulders, looseflints, loosegears, looseores, loosestick, loosestones, lootvessel, metal, metalpartpile, muddygravel, oillamp, omoktabletop, pan, pie, quern, sand, seashell, sieve, sludgygravel, snowlayer, stonecoffinlid, storagevessel, table, talldisplaycase, toolmold, wateringcan, woodbucket |
WrenchOrientable |
|
banner, brickslabs, brickstairs, carvedlog, chute, clayshinglelabs, clayshinglestairs, clutter, cobblestoneslab, cobblestonestairs, debarkedlog, glassslab, jonas, log, mudbrickslab, planks, plankslab, plankstairs, plaster, polishedrockslab, quartzpillar, quartzslab, quartzstairs, stonebrickslab, stonebrickstairs, stonepathstairs |
WorldEditFixGhostBlockPlace | - | - |
![Icon Sign.png](/images/thumb/1/15/Icon_Sign.png/32px-Icon_Sign.png)
Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.
Modding | |
---|---|
Modding Introduction | Getting Started • Theme Pack |
Content Modding | Content Mods • Developing a Content Mod • Basic Tutorials • Intermediate Tutorials • Advanced Tutorials • Content Mod Concepts |
Code Modding | Code Mods • Setting up your Development Environment |
Property Overview | Item • Entity • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |