Hidden System - Cmdpro/Databank GitHub Wiki
Overview
The Hidden System allows you to hide one thing as another until certain conditions have been met, and optionally override its name - by default, it takes on the name of what it is hidden as. This allows for dynamically revealing things to players as they progress through your mod or modpack. The system uses json files to determine what should be hidden, and how.
For example, you can hide a diamond ore block as ordinary stone, until the player has obtained the advancement for getting an iron pickaxe. Until they have it, for all intents and purposes that block will behave as and drop stone.
Modders can easily add custom reveal conditions if the built-in advancement-based revealing does not suit your use case. It's also possible to add other hidden types than the standard blocks and items.
All hidden entries are expected to be located at /data/<your namespace>/databank/hidden/
, and it is recommended to add subfolders per type, such as blocks
and items
.
Reveal Conditions
In a hidden entry, you need to define the reveal condition - when this thing should get shown to the player for what it is. Databank features the following conditions built-in:
databank:advancement
- Hide until the specified advancement has been made. Fields:advancement
(advancement identifier).databank:and
- Both conditions must be met. Fields:conditionA
(condition object),conditionB
(condition object).databank:or
- Either condition must be met, but not necessarily both. Fields:conditionA
(condition object),conditionB
(condition object).databank:not
- Invert the specified condition - do not hide until it has been met. Fields:condition
(condition object).
Hidden Types
In a hidden entry, you also need to define the type of thing the hiding is applied to - this is what actually states what that thing should be hidden as. Databank features the following types built-in:
databank:block
- Hide a block as another block. Fields:hidden_as
(block identifier),original
(block identifier),name_override
(optional component).databank:item
- Hide an item as another item. Fields:hidden_as
(item identifier),original
(item identifier),name_override
(optional component).
Making New Conditions and Types
Conditions extend HiddenCondition
, and types extend HiddenTypeInstance.HiddenType
. For examples on how to make your own, see Databank's respective conditions and types.
Examples
Hiding a block as another block with a custom condition
{
"condition": {
"type": "datanessence:entry",
"entry": "datanessence:basics/lensing_crystals",
"completion_stage": 0
},
"type": {
"type": "databank:block",
"hidden_as": "minecraft:stone",
"original": "datanessence:lensing_crystal_ore"
}
}
Hiding an item as another item with an advancement and name override
{
"condition": {
"type": "databank:advancement",
"advancement": "minecraft:story/iron_tools"
},
"type": {
"type": "databank:item",
"hidden_as": "minecraft:coal",
"original": "minecraft:diamond",
"name_override": {
"translate": "item.minecraft.diamond"
}
}
}