Modding:Json Block Behaviors: Difference between revisions
From Vintage Story Wiki
(Add link to BlockDropItemStack, even though it doesn't exist yet) |
(→Adding behaviors to your block: Link to behavior traversal) Tags: Mobile edit Mobile web edit |
||
Line 1: | Line 1: | ||
== Adding behaviors to your block == | == Adding behaviors to your block == | ||
A block [[Modding:Behavior_Traversal|behavior]] encapsulates a modular, reusable feature that can be added to blocks. 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"> |
Latest revision as of 15:47, 3 November 2024
Adding behaviors to your block
A block behavior encapsulates a modular, reusable feature that can be added to blocks. 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 | - | - |
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 • Entity Behaviors • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • Collectible 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 |