Modding:Json Block Behaviors: Difference between revisions
From Vintage Story Wiki
(→All Block Behaviors: Update for 1.18.14) |
(→Adding behaviors to your block: Be more specific about where to add the behaviors field.) |
||
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>behaviours</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> | ||
== All Block Behaviors == | == All Block Behaviors == | ||
Here is a table containing all properties of the base game as of 1.18.14. | Here is a table containing all properties of the base game as of 1.18.14. |
Revision as of 02:26, 11 October 2023
Adding behaviors to your block
Block behaviors are an array of objects with properties attached to your block. They are added through the behaviours
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"}],
...
}
All Block Behaviors
Here is a table containing all properties of the base game as of 1.18.14.
Behavior Name | Additional Properties | Used by Blocks | Detail link |
---|---|---|---|
BlockEntityInteract | none | door | Block Entity Interact |
BreakIfFloating | none | termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog | Break if Floating |
BreakSnowFirst | none | tallgrass, stonepath | Break Snow First |
CanAttach | sides | drystonefence, woodenfence, roughhewnfence | Can Attach |
CanIgnite | none | torch | Can Ignite |
CollectFrom | none | henbox | Collect From |
Container | none | storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket | Container |
Decor | sides, sidedVariants, nwOrientable, drawIfCulled, alternateZOffset, notFullFace, removable, thickness | linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart | Decor |
Door | none | door | Door |
DropNotSnowCovered | none | fern, flower | Drop not Snow Covered |
ExchangeOnInteract | exchangeStates (string array of block states) sounds (path from sounds folder) actionLangCode (language key from the lang file) |
trapdoor | Exchange On Interact |
FiniteSpreadingLiquid | liquidCollisionSound (path from sounds folder) sourceReplacementCode (block code) flowingReplacementCode (block code) collidesWith (other liquid) spreadDelay (int, default: 0) |
boilingwater, water, lava, saltwater | Finite Spreading Liquid |
Harvestable | harvestTime (float, seconds, default: 0) harvestedStack (BlockDropItemStack) harvestingSound (path from sounds folder) harvestedBlockCode (block code) |
bigberrybush, saguarocactus, smallberrybush, log-resin | Harvestable |
HeatSource | heatStrength (float) | boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire | Heat Source |
HorizontalAttachable | handleDrops (bool, default: true) dropBlockFace (Compass Direction, default: "north") dropBlock (block name) attachmentAreas (side -> cuboid) attachmentArea (cuboid) |
tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack | Horizontal Attachable |
HorizontalOrientable | dropBlockFace (Compass Direction, default: "North") drop (block 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 | Horizontal Orientable |
HorizontalUpDownOrientable | none | - | Horizontal Up/Down Orientable |
Ignitable | none | charcoalpit, clayoven, firepit | Ignitable |
JonasBoilerDoor | none | jonas | Jonas Boiler Door |
JonasGasifier | none | jonas | Jonas Gasifier |
JonasHydraulicPump | none | jonas | Jonas Hydraulic Pump |
Ladder | dropBlockFace (face direction, Default: north) isFlexible (bool, default: false) |
ladder | Ladder |
Lockable | none | archimedesscrew, chest, chute, cokeovendoor, crate, door, hopper, irondoor, labeledchest, roughhewnfencegate, stationarybasket, storagevessel, trapdoor, trunk, woodenfencegate | Lockable |
MilkingContainer | none | woodbucket | Milking Container |
Multiblock | sizex, sizey, sizez, type, cposition | jonas, riftward, verticalboiler, banner, trunk, painting | Multiblock |
MyceliumHost | none | creativegrass, forestfloor, log, soil | Mycelium Host |
NoParticles | none | claybrickchimney | No Particles |
NWOrientable | none | bookshelves, claybrickchimney, fruitpress, fruitpresstop, mannequin, slantedroofingridge, transmission, trough, woodenpath, woodentoggle | North/West Orientable |
OmniAttachable | facingCode (string, default: orientation) attachmentAreas (side -> cuboid) |
crystal, lantern | Omni-Attachable |
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 | Omni-Rotatable |
Pillar | invertedPlacement (bool, default: false) | carvedlog, debarkedlog, hay, log, lognarrow, planks, plaster, quartzpillar, stackedbamboo, woodenaxle | Pillar |
Pumpkin | vineGrowthStage(int), vineGrowthQuantity(NatFloat) | crop | Pumpkin |
PushEventOnBlockBroken | eventName (string) | bamboo, bambooleaves, leaves, leavesbranchy, leavesnarrow, log, lognarrow, logsection | Push Event on Block Broken |
RainDrip | none | - | RainDrip |
Reinforcable | none | - | Reinforcable |
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 | Right Click Pickup |
RopeTieable | none | roughhewnfence, woodenfence | Rope Tieable |
Slab | none | - | Slab |
Steaming | none | boilingwater | Steaming |
SneakPlacing | none | pan, pie, wateringcan | Sneak Placing |
Unplaceable | none | bloomerychimney, bowl, bowl-meal, clayplanter, claypot, crock, crucible, flowerpot, ingotmold, jug, metal, pineapple, pumpkin, storagevessel, toolmold, wateringcan | Unplaceable |
Unstable | attachedToFaces (default: down) attachmentAreas (side -> cuboid) |
bunchocandles, crop, deadcrop, firepit, oreblastingbomb, silvertorchcactus, verticalboiler, wildbeehive, woodenpath, woodenrails | Unstable |
UnstableFalling | attachableFaces (string array) attachmentAreas (cuboid) attachmentAreas (side -> cuboid) 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 | Unstable Falling |
WrenchOrientable | hideInteractionHelpInSurvival (bool, default: false), baseCode (block code) | 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 | Wrench Orientable |
WorldEditFixGhostBlockPlace | none | - | World Edit Fix Ghost Block Place |
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 |