diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index f3fe16222..e718593f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -56,8 +56,11 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils +import at.hannibal2.skyhanni.utils.renderables.DragNDrop +import at.hannibal2.skyhanni.utils.renderables.Droppable import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.renderables.Renderable.Companion.renderBounds +import at.hannibal2.skyhanni.utils.renderables.toDragItem import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.init.Blocks @@ -202,7 +205,7 @@ object SkyHanniDebugsAndTests { onClick = { resetConfig() }, "§eClick to confirm.", prefix = false, - oneTimeClick = true + oneTimeClick = true, ) } @@ -535,6 +538,45 @@ object SkyHanniDebugsAndTests { config.debugPos.renderStringsAndItems(displayList, posLabel = "Test Display") } + @SubscribeEvent + fun onGuiRenderChestGuiOverlayRender(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { + @Suppress("ConstantConditionIf") + if (false) { + dragAbleTest() + } + } + + private fun dragAbleTest() { + val bone = ItemStack(Items.bone, 1).toDragItem() + val leaf = ItemStack(Blocks.leaves, 1).toDragItem() + + config.debugItemPos.renderRenderables( + listOf( + DragNDrop.draggable(Renderable.string("A Bone"), { bone }), + Renderable.placeholder(0, 30), + DragNDrop.draggable(Renderable.string("A Leaf"), { leaf }), + Renderable.placeholder(0, 30), + DragNDrop.droppable( + Renderable.string("Feed Dog"), + object : Droppable { + override fun handle(drop: Any?) { + val unit = drop as ItemStack + if (unit.item == Items.bone) { + LorenzDebug.chatAndLog("Oh, a bone!") + } else { + LorenzDebug.chatAndLog("Disgusting that is not a bone!") + } + } + + override fun validTarget(item: Any?) = item is ItemStack + + }, + ), + ), + posLabel = "Item Debug", + ) + } + private fun itemRenderDebug() { val scale = 0.1 val renderables = listOf( @@ -547,7 +589,8 @@ object SkyHanniDebugsAndTests { }.editCopy { this.add( 0, - generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) }.toList(), + generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) } + .toList(), ) } config.debugItemPos.renderRenderables( |