Skip to content

Commit

Permalink
Update linkables.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTheodor authored Sep 11, 2024
1 parent 4189de2 commit 2cc206d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions content/development/linkables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Linkables
next: components
type: docs
--

Expand All @@ -9,7 +8,7 @@ Linkables are elements of the game which have the ability to be linked to a TARD
Those can be items, blocks, entities (& more if you implement it yourself).

# Items
To make your item linkable just extend the `LinkableItem` class.
To make your item linkable just extend the `LinkableItem` class, then use one of the static methods it provides to get the tardis instance.

# Blocks
Since blocks cannot contain NBT data on their own, it is impossible to save the TARDIS id the block belongs to in the block itself.
Expand All @@ -20,4 +19,6 @@ Make your block entity class extend the `LinkableBlockEntity` class.

The base `LinkableBlockEntity` class will not link on it's own, to forcefully link it use one of the `#link` method it provides.

To make it easier, we've also made an `InteriorLinkableBlockEntity` which will automatically link to the interior it gets placed in.
To make it easier, we've also made an `InteriorLinkableBlockEntity` which will automatically link to the interior it gets placed in.

If you already save or read some NBT data in your block entity, make sure that the overriden `#readNbt` and `#writeNbt` methods also call their super variant (e.g. `super.readNbt(whatever);`). Otherwise, the code that is responsible for saving and reading the link data will not execute.

0 comments on commit 2cc206d

Please sign in to comment.