Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 2.0.8 to 1.16 #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8

plugins {
id("fabric-loom")
Expand Down Expand Up @@ -31,7 +31,7 @@ tasks.named<Copy>("processResources") {
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "21"
kotlinOptions.jvmTarget = "1.8"
}

tasks.withType<Jar> {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx1G

# Project
version=2.0.8
version=2.0.8+1.16

# Versions (https://fabricmc.net/develop)
minecraft=1.20.6
yarn=1.20.6+build.1
minecraft=1.16.5
yarn=1.16.5+build.10
loader=0.15.11

fabric_api=0.98.0+1.20.6
fabric_api=0.42.0+1.16
fabric_kotlin=1.10.20+kotlin.1.9.24
7 changes: 5 additions & 2 deletions src/main/kotlin/dev/auxves/disco/Disc.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
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.text.TranslatableText
import net.minecraft.util.Identifier
import net.minecraft.util.Rarity

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

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

import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents
import net.fabricmc.loader.api.FabricLoader
import net.minecraft.item.ItemGroups
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.util.registry.Registry

fun init() {
val addons = FabricLoader.getInstance().allMods
Expand All @@ -14,10 +11,6 @@ fun init() {
val discs = addons.flatMap { it.discs }

discs.forEach {
Registry.register(Registries.ITEM, it.id, it)
}

ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register { entries ->
discs.forEach(entries::add)
Registry.register(Registry.ITEM, it.id, it)
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"mixins": [],
"depends": {
"minecraft": ">=1.20",
"fabric-api": "*",
"minecraft": "1.16.x",
"fabric": "*",
"fabric-language-kotlin": "*"
}
}
Loading