Json block behaviors Unplaceable: Difference between revisions
(→Purpose: link to groundstorable) |
(→Purpose: link back to block behaviors) |
||
Line 1: | Line 1: | ||
== Purpose == | == 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''' behavior takes away the block's right click to place behavior, making the block functionally like an item. | 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''' [[Modding:Json_Block_Behaviors|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. | 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. |
Latest revision as of 15:03, 24 October 2024
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
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 |