leaves: use new reflection

This commit is contained in:
Moritz Zwerger 2024-02-02 15:57:26 +01:00
parent 9c84f6caec
commit 1be37cd9ba
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -13,7 +13,8 @@
package de.bixilon.minosoft.data.registries.blocks.types.wood
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
import de.bixilon.kutil.reflection.ReflectionUtil.field
import de.bixilon.kutil.reflection.ReflectionUtil.jvmField
import de.bixilon.minosoft.data.container.stack.ItemStack
import de.bixilon.minosoft.data.direction.Directions
import de.bixilon.minosoft.data.registries.blocks.light.CustomLightProperties
@ -47,7 +48,7 @@ abstract class LeavesBlock(identifier: ResourceLocation, settings: BlockSettings
override val tintProvider: TintProvider? = null
override fun initTint(manager: TintManager) {
this::tintProvider.forceSet(manager.foliage)
TINT_PROVIDER.set(this, manager.foliage)
}
override fun buildState(version: Version, settings: BlockStateSettings): BlockState {
@ -73,6 +74,7 @@ abstract class LeavesBlock(identifier: ResourceLocation, settings: BlockSettings
}
companion object {
private val TINT_PROVIDER = LeavesBlock::tintProvider.jvmField.field
val LIGHT_PROPERTIES = CustomLightProperties(true, false, true)
}
}

View File

@ -333,6 +333,7 @@ object KUtil {
return x.matches(other.x, margin) && y.matches(other.y, margin) && z.matches(other.z, margin)
}
@Deprecated("jiibles 1.2")
fun <T> table(elements: Collection<T>, vararg headers: AnyString, builder: (T) -> Array<Any?>?): Table {
val table = Table(headers.unsafeCast())