Replace the @ButtonInfo.Ignored annotation with a property of ButtonInfo

This commit is contained in:
Username404 2021-06-24 22:22:36 +02:00
parent dd2c01b461
commit 4143ef0e14
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
3 changed files with 4 additions and 9 deletions

View File

@ -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(ButtonInfo.Ignored::class.java)))
protected fun Class<*>.isValidForButtonCollection(): Boolean = (!((Modifier.isAbstract(javaClass.modifiers)) || javaClass.annotations.any { it is ButtonInfo && it.ignored }))
private val displayInitMessage: Boolean by Configuration
companion object {
val MissingComponent: TranslatableComponent = object: TranslatableComponent(null) { override fun getString(): String = "MISSING_COMPONENT" }

View File

@ -11,13 +11,9 @@ import net.minecraft.network.chat.TranslatableComponent
@Retention(AnnotationRetention.RUNTIME)
annotation class ButtonInfo(
val parent: Category,
val kind: Type = Type.TOGGLE
val kind: Type = Type.TOGGLE,
val ignored: Boolean = false /** Excludes a class from button collection **/
) {
/**
* Excludes a class from button collection
*/
annotation class Ignored
companion object {
internal var lightningFactor: Float = 0.33F
enum class Type {

View File

@ -9,8 +9,7 @@ import net.minecraft.client.Minecraft
* @property title The title of the macro
*/
@Serializable
@ButtonInfo.Ignored
@ButtonInfo(Category.MACROS, kind = Type.CLICK)
@ButtonInfo(Category.MACROS, kind = Type.CLICK, ignored = true)
data class Macro(
@JvmField var command: String,
override var title: String = command