Skip to content

Commit

Permalink
update for 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
auxves committed Nov 18, 2022
1 parent 8d06e68 commit ee66515
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 139 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Disco is a modular music disc loader built for Fabric.

Being a **loader**, it doesn't add any music discs by default and relies on addon packs to provide the sound files, textures, and translations.

## Usage

Instructions on creating your own addon can be found [here][wiki].

For end users, the addon's `.jar` file should be placed in the fabric `mods` directory.

## Dependencies

- [Fabric Loader]
Expand All @@ -14,17 +20,13 @@ Being a **loader**, it doesn't add any music discs by default and relies on addo

You have three options for downloading Disco.

- [CurseForge]
- [Modrinth]
- [GitHub Releases]
- [Modrinth]
- [CurseForge]

## Usage

Disco addons are JAR files that contain a resource pack, a data pack, and a `fabric.mod.json`. An unpacked example can be found [here][example].

To create a JAR file from an unpacked addon, simply compress it into a zip file and rename the extension to `.jar`.
## Suggestions

> IMPORTANT: Make sure the `.ogg` files only have 1 audio channel (mono)
- [Vibes] - Portable music disc player

<!-- Dependencies -->

Expand All @@ -36,8 +38,12 @@ To create a JAR file from an unpacked addon, simply compress it into a zip file

[curseforge]: https://www.curseforge.com/minecraft/mc-mods/disco
[modrinth]: https://modrinth.com/mod/disco
[github releases]: https://github.com/glossnyx/disco/releases
[github releases]: https://github.com/auxves/disco/releases

<!-- Recommendations -->

[vibes]: https://github.com/auxves/vibes

<!-- Example -->
<!-- Wiki -->

[example]: https://github.com/glossnyx/disco/tree/example
[wiki]: https://github.com/auxves/disco/wiki/Adding-a-Disc
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ dependencies {
mappings("net.fabricmc:yarn:${p("yarn")}:v2")

modImplementation("net.fabricmc:fabric-loader:${p("loader")}")

listOf("fabric-resource-loader-v0", "fabric-loot-tables-v1", "fabric-registry-sync-v0").forEach {
modImplementation(fabricApi.module(it, p("fabric_api")))
}

modImplementation("net.fabricmc.fabric-api:fabric-api:${p("fabric_api")}")
modImplementation("net.fabricmc:fabric-language-kotlin:${p("fabric_kotlin")}")
}

Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.jvmargs=-Xmx1G
# Project
id=disco
title=Disco
author=glossnyx
author=auxves
description=Modular music disc loader
version=2.0.6
version=2.0.7

# Versions (https://modmuss50.me/fabric.html)
minecraft=1.18.2
yarn=1.18.2+build.2
loader=0.13.3
minecraft=1.19.2
yarn=1.19.2+build.28
loader=0.14.10

fabric_api=0.48.0+1.18.2
fabric_kotlin=1.7.1+kotlin.1.6.10
fabric_api=0.66.0+1.19.2
fabric_kotlin=1.8.6+kotlin.1.7.21
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pluginManagement {
}

plugins {
id("fabric-loom") version "0.11-SNAPSHOT"
kotlin("jvm") version "1.6.10"
id("fabric-loom") version "1.0-SNAPSHOT"
kotlin("jvm") version "1.7.21"
}
}
12 changes: 0 additions & 12 deletions src/main/java/io/glossnyx/disco/mixin/LootTableAccessor.java

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/kotlin/dev/auxves/disco/Addons.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package dev.auxves.disco

import net.fabricmc.loader.api.FabricLoader
import net.fabricmc.loader.api.metadata.ModMetadata
import net.minecraft.util.Identifier

data class Addon(
val id: String,
val discs: List<Disc>,
)

private fun ModMetadata.toAddon(): Addon {
val custom = getCustomValue(modName).asObject

val discs = custom.get("discs").asArray.map {
val obj = it.asObject
val identifier = Identifier(id, obj.get("id").asString)
val duration = obj.get("duration").asNumber.toInt()

Disc(identifier, duration)
}

return Addon(id, discs)
}

val addons = FabricLoader.getInstance().allMods
.filter { it.metadata.customValues.containsKey(modName) }
.map { it.metadata.toAddon() }
21 changes: 21 additions & 0 deletions src/main/kotlin/dev/auxves/disco/Disc.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.auxves.disco

import net.minecraft.item.Item
import net.minecraft.item.ItemGroup
import net.minecraft.item.ItemStack
import net.minecraft.item.MusicDiscItem
import net.minecraft.sound.SoundEvent
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import net.minecraft.util.Rarity

private val settings = Item.Settings()
.group(ItemGroup.MISC)
.rarity(Rarity.RARE)
.maxCount(1)

class Disc(val id: Identifier, duration: Int) : MusicDiscItem(15, SoundEvent(id), settings, duration) {
override fun getName(stack: ItemStack?): Text {
return Text.translatable("item.minecraft.music_disc_cat")
}
}
14 changes: 14 additions & 0 deletions src/main/kotlin/dev/auxves/disco/Entrypoint.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.auxves.disco

import net.minecraft.util.registry.Registry

const val modName = "disco"

@Suppress("unused")
fun init() {
addons.flatMap { it.discs }.forEach {
Registry.register(Registry.ITEM, it.id, it)
}

println("Disco loaded!")
}
35 changes: 0 additions & 35 deletions src/main/kotlin/io/glossnyx/disco/Addons.kt

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/kotlin/io/glossnyx/disco/Entrypoint.kt

This file was deleted.

3 changes: 0 additions & 3 deletions src/main/resources/assets/disco/lang/en_us.json

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/resources/disco.mixins.json

This file was deleted.

13 changes: 5 additions & 8 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@
"description": "${description}",
"authors": ["${author}"],
"contact": {
"homepage": "https://github.com/${author}/${id}",
"homepage": "https://auxves.dev/${id}",
"sources": "https://github.com/${author}/${id}"
},
"license": "MIT",
"icon": "assets/${id}/icon.png",
"environment": "*",
"entrypoints": {
"main": ["io.${author}.${id}.EntrypointKt::init"]
"main": ["dev.${author}.${id}.EntrypointKt::init"]
},
"mixins": ["${id}.mixins.json"],
"mixins": [],
"depends": {
"minecraft": "1.18.x",
"fabricloader": "*",
"fabric-resource-loader-v0": "*",
"fabric-loot-tables-v1": "*",
"fabric-registry-sync-v0": "*",
"minecraft": "1.19.x",
"fabric-api": "*",
"fabric-language-kotlin": "*"
}
}

0 comments on commit ee66515

Please sign in to comment.