Json block behaviors Unplaceable

From Vintage Story Wiki
Revision as of 15:03, 24 October 2024 by Bluelightning32 (talk | contribs) (→‎Purpose: link back to block behaviors)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Purpose

Blocks are essentially items that can also exist as placed blocks in the terrain. Whereas items can only exist in inventories, or as temporary drops in the world. The Unplaceable block behavior takes away the block's right click to place behavior, making the block functionally like an item.

This behavior is added to blocks that are only blocks for historical reasons but today should act like items. This way, if the world was upgraded, any placed copies of the block before the upgrade can still be picked up, but they cannot be placed back down after being picked up.

The vanilla blocks often uses this behavior in combination with the GroundStorable behavior. That behavior will intercept the right click and instead of placing the block in the world, the behavior creates a new groundstorage block in the world. The groundstorage block is an inventory that shows its contents, kind of a like a chest with invisible walls. So blocks with the GroundStorable property should never be directly placed as blocks (instead they should be stored in groundstorage blocks). As an additional layer of safety, the Unplaceable behavior is added to catch any right clicks that make their way through the GroundStorable behavior, and to document that the block is functionally like an item.

Used by blocks

  • ingotmold
  • bloomerychimney -- the bloomery base block intercepts the right click instead, then pulls the chimney out of the inventory and places it, instead of letting the chimney place itself.
  • bowl
  • bowl-meal
  • crock
  • crucible
  • dirtypot
  • flowerpot
  • jug
  • metal scraps
  • planter
  • pot
  • pineapple
  • pumpkin
  • sieve
  • storagevessel
  • wateringcan
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 ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository