Rename ButtonAnnotations.kt to ButtonInfo.kt and move the Ignored annotation to ButtonInfo
This commit is contained in:
parent
b4d64b0d96
commit
b03fd16898
|
@ -3,7 +3,7 @@ package fr.username404.snowygui
|
||||||
import fr.username404.snowygui.EventSnowy.Companion.useKey
|
import fr.username404.snowygui.EventSnowy.Companion.useKey
|
||||||
import fr.username404.snowygui.config.Configuration
|
import fr.username404.snowygui.config.Configuration
|
||||||
import fr.username404.snowygui.gui.feature.ButtonImpl
|
import fr.username404.snowygui.gui.feature.ButtonImpl
|
||||||
import fr.username404.snowygui.gui.feature.Ignored
|
import fr.username404.snowygui.gui.feature.ButtonInfo
|
||||||
import fr.username404.snowygui.misc.AddKeyMaps
|
import fr.username404.snowygui.misc.AddKeyMaps
|
||||||
import net.minecraft.network.chat.TranslatableComponent
|
import net.minecraft.network.chat.TranslatableComponent
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
|
@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger
|
||||||
import java.lang.reflect.Modifier
|
import java.lang.reflect.Modifier
|
||||||
|
|
||||||
abstract class Snowy {
|
abstract class Snowy {
|
||||||
protected fun Class<*>.isValidForButtonCollection(): Boolean = (!((Modifier.isAbstract(javaClass.modifiers)) || javaClass.isAnnotationPresent(Ignored::class.java)))
|
protected fun Class<*>.isValidForButtonCollection(): Boolean = (!((Modifier.isAbstract(javaClass.modifiers)) || javaClass.isAnnotationPresent(ButtonInfo.Ignored::class.java)))
|
||||||
private val displayInitMessage: Boolean by Configuration
|
private val displayInitMessage: Boolean by Configuration
|
||||||
companion object {
|
companion object {
|
||||||
val MissingComponent: TranslatableComponent = object: TranslatableComponent(null) { override fun getString(): String = "MISSING_COMPONENT" }
|
val MissingComponent: TranslatableComponent = object: TranslatableComponent(null) { override fun getString(): String = "MISSING_COMPONENT" }
|
||||||
|
|
|
@ -13,6 +13,11 @@ annotation class ButtonInfo(
|
||||||
val parent: Category,
|
val parent: Category,
|
||||||
val kind: Type = Type.TOGGLE
|
val kind: Type = Type.TOGGLE
|
||||||
) {
|
) {
|
||||||
|
/**
|
||||||
|
* Excludes a class from button collection
|
||||||
|
*/
|
||||||
|
annotation class Ignored
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal var lightningFactor: Float = 0.33F
|
internal var lightningFactor: Float = 0.33F
|
||||||
enum class Type {
|
enum class Type {
|
||||||
|
@ -42,8 +47,3 @@ annotation class ButtonInfo(
|
||||||
ClickGui.components.add(box)
|
ClickGui.components.add(box)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Excludes a class from button collection
|
|
||||||
*/
|
|
||||||
annotation class Ignored
|
|
|
@ -5,6 +5,7 @@ import kotlinx.serialization.Serializable
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ButtonInfo.Ignored
|
||||||
@ButtonInfo(Category.MACROS, kind = Type.CLICK)
|
@ButtonInfo(Category.MACROS, kind = Type.CLICK)
|
||||||
data class Macro(
|
data class Macro(
|
||||||
@JvmField var command: String,
|
@JvmField var command: String,
|
||||||
|
|
Loading…
Reference in New Issue