From 970dfddaf9e80d6b206f411139227397f4d9e847 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 17 Nov 2024 17:29:15 +0100 Subject: feat: Add bazaar/ah search hotkey --- .../kotlin/util/mc/FirmamentDataComponentTypes.kt | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt (limited to 'src/main/kotlin/util/mc') diff --git a/src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt b/src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt new file mode 100644 index 0000000..012f52e --- /dev/null +++ b/src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt @@ -0,0 +1,36 @@ +package moe.nea.firmament.util.mc + +import com.mojang.serialization.Codec +import net.minecraft.component.ComponentType +import net.minecraft.registry.Registries +import net.minecraft.registry.Registry +import moe.nea.firmament.Firmament +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.events.ClientInitEvent + +object FirmamentDataComponentTypes { + + @Subscribe + fun init(event: ClientInitEvent) { + } + + private fun register( + id: String, + builderOperator: (ComponentType.Builder) -> Unit + ): ComponentType { + return Registry.register( + Registries.DATA_COMPONENT_TYPE, + Firmament.identifier(id), + ComponentType.builder().also(builderOperator) + .build() + ) + } + + val IS_BROKEN = register( + "is_broken" + ) { + it.codec(Codec.BOOL.fieldOf("is_broken").codec()) + } + + +} -- cgit