Connectable Furniture
Feature introduced in Nexo 1.5
Last updated
Feature introduced in Nexo 1.5
Last updated
Nexo allows you to make furniture that can connect together to form different visual furnitures. An example would be a chair that can be turned into a couch, or a small table into a larger one.
A connectable furniture is made up of a few different variations. Above you can see an example of all of these. They are used to decide when to display what. DEFAULT - The base-item, what is placed when not connected to anything LEFT & RIGHT - The left/right end of a connectable furniture STRAIGHT - The piece between a LEFT & RIGHT INNER - Corner facing inwards OUTER - Corner facing outwards
There are a few different ways to add this mechanic to your furniture-item, ITEM_MODEL & ITEM type.
ITEM_MODEL is only available for 1.21.2+ servers but is the recommended approach. This also allows for two different approaches when making the furniture. First using a "BlockState ItemModel" approach. This is the recommended as it limits the amount of files needed in your ResourcePack ITEM is an approach mainly intended for 1.20.4 -> 1.21.1 servers. This relies on NexoItems to define the model used for a connection-variation. The end product is the same but compared to ITEM_MODEL, this approach requires an additional 5 NexoItems, cluttering config-files.
ITEM_MODEL works by directly setting the ItemModel to use on the furniture, instead of going through a NexoItem. This requires that you provide the necessary ItemModels, but they are very easy to make. Nexo does not generate these ItemModels for you.
There is also two approaches you can take to this, Connection-State ItemModel and normal, basic ItemModels.
BlockState ItemModel works by making an ItemModel that shows a different Model based on a property on the item This means you only need to make one ItemModel JSON file.
An ItemModel is used to alter the base-model of an Item and is not the same as CustomModelData. An ItemModel will link to a normal Model, below are examples of the two approaches to use in Nexo.
This is largely the same as a normal basic ItemModel, but works as a replacement for needing many. It works by selecting a Model based on the "connection-state" on the item.
Here is an example of a ConnectionState ItemModel. It should be fairly self-explanatory. The FurnitureItem displayed to the player has a tag on it specifying the connection-state. This in turn tells the client what model to use from this ItemModel. This reduces the amount of ResourcePack files needed & simplifies the NexoItem config aswell.
This ItemModel should be put in for-example; Nexo/pack/assets/nexo/items/connectable/connectable.json
Here is the NexoItem-config utilizing this ConnectionState-ItemModel. We do not need to specify any of the sub-properties. It will simply use the ItemModel we specify in Components section.
This requires you to make a basic ItemModel for each of the connection-states, which looks as follows;
Now repeat this for all six connection-states, pointing to the different Models and put them in your ResourcePack.
Example path being; Nexo/pack/assets/nexo/items/connectable/connectable.json
Then we just need to make the NexoItem config, and point it to the different Connection-State ItemModels it should use.