Skip to content

Adding a Disc

Auxves edited this page Nov 18, 2022 · 7 revisions

Let's assume that your addon is called disco-example and the id of your new disc is new_disc. Replace these with the actual ones in the following steps.

A full example can be found in the example branch

Audio

  1. Convert your audio to a .ogg file with one channel (mono)
  2. Place the file at assets/disco-example/sounds/new_disc.ogg

fabric.mod.json

Add the following line to the fabric.mod.json file at the root of your project. If this file doesn't already exist, create it with the following contents contents:

The duration is the length of the audio in seconds.

{
    "schemaVersion": 1,
    "id": "disco-example",
    "version": "1.0.0",
    "name": "Disco Example",
    "description": "Example Disco addon",
    "custom": {
        "disco": {
            "discs": [
+               { "id": "new_disc", "duration": 123 }
            ]
        }
    }
}

sounds.json

Add the following lines to assets/disco-example/sounds.json:

{
+   "new_disc": {
+       "category": "record",
+       "sounds": [{ "name": "disco-example:new_disc", "stream": true }]
+   }
}

Texture

Place your 16x16 sprite at assets/disco-example/textures/item/new_disc.png

Model

Create assets/disco-example/models/item/new_disc.json with the following contents:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "disco-example:item/new_disc"
    }
}

Translations

Add the following line to assets/disco-example/lang/en_us.json:

{
+   "item.disco-example.new_disc.desc": "Artist - New Disc"
}

Make sure to add this to any other languages your addon supports

Clone this wiki locally