Rename ButtonAnnotations.kt to ButtonInfo.kt and move the Ignored annotation to ButtonInfo

This commit is contained in:
Username404 2021-06-09 07:23:11 +02:00
parent b4d64b0d96
commit b03fd16898
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
3 changed files with 8 additions and 7 deletions

View File

@ -3,7 +3,7 @@ package fr.username404.snowygui
import fr.username404.snowygui.EventSnowy.Companion.useKey
import fr.username404.snowygui.config.Configuration
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 net.minecraft.network.chat.TranslatableComponent
import org.apache.logging.log4j.LogManager
@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger
import java.lang.reflect.Modifier
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
companion object {
val MissingComponent: TranslatableComponent = object: TranslatableComponent(null) { override fun getString(): String = "MISSING_COMPONENT" }

View File

@ -13,6 +13,11 @@ annotation class ButtonInfo(
val parent: Category,
val kind: Type = Type.TOGGLE
) {
/**
* Excludes a class from button collection
*/
annotation class Ignored
companion object {
internal var lightningFactor: Float = 0.33F
enum class Type {
@ -42,8 +47,3 @@ annotation class ButtonInfo(
ClickGui.components.add(box)
}
}
/**
* Excludes a class from button collection
*/
annotation class Ignored

View File

@ -5,6 +5,7 @@ import kotlinx.serialization.Serializable
import net.minecraft.client.Minecraft
@Serializable
@ButtonInfo.Ignored
@ButtonInfo(Category.MACROS, kind = Type.CLICK)
data class Macro(
@JvmField var command: String,