-
Notifications
You must be signed in to change notification settings - Fork 4
Hidden System
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.
In a hidden entry, you need to define a reveal condition - when this thing should get shown to the player for what it is. Databank features the following conditions built-in:
-
databank:actual_player- A real player must be trying to break this block (used for loot). -
databank:advancement- Hide until the specified advancement has been made. Fields:advancement(advancement identifier). -
databank:always_true- This condition is always true. -
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).
If you want a hidden block to drop its actual loot regardless of whether a player can break it or not—ideal for allowing automation of hidden blocks, especially if the items they drop are still hidden—then you can add a condition to drop_original_loot_condition, like so:
"drop_original_loot_condition": {
"type": "databank:not",
"condition": {
"type": "databank:actual_player"
}
}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).
Conditions extend HiddenCondition, and types extend HiddenTypeInstance.HiddenType. For examples on how to make your own, see Databank's respective conditions and types.
{
"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"
}
}{
"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"
}
}
}