From 1be37cd9ba7264a4c08b64b853860721dd727d81 Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Fri, 2 Feb 2024 15:57:26 +0100 Subject: [PATCH] leaves: use new reflection --- .../data/registries/blocks/types/wood/LeavesBlock.kt | 8 +++++--- src/main/java/de/bixilon/minosoft/util/KUtil.kt | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/LeavesBlock.kt b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/LeavesBlock.kt index 4b083dda5..e06786a13 100644 --- a/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/LeavesBlock.kt +++ b/src/main/java/de/bixilon/minosoft/data/registries/blocks/types/wood/LeavesBlock.kt @@ -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) } } diff --git a/src/main/java/de/bixilon/minosoft/util/KUtil.kt b/src/main/java/de/bixilon/minosoft/util/KUtil.kt index aa819a438..de11d1d21 100644 --- a/src/main/java/de/bixilon/minosoft/util/KUtil.kt +++ b/src/main/java/de/bixilon/minosoft/util/KUtil.kt @@ -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 table(elements: Collection, vararg headers: AnyString, builder: (T) -> Array?): Table { val table = Table(headers.unsafeCast())