feat: Add debug UI for block types
This commit is contained in:
@@ -15,6 +15,7 @@ import moe.nea.firmament.features.debug.PowerUserTools
|
|||||||
import moe.nea.firmament.features.inventory.buttons.InventoryButtons
|
import moe.nea.firmament.features.inventory.buttons.InventoryButtons
|
||||||
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlayScreen
|
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlayScreen
|
||||||
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverviewScreen
|
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverviewScreen
|
||||||
|
import moe.nea.firmament.features.mining.MiningBlockInfoUi
|
||||||
import moe.nea.firmament.gui.config.AllConfigsGui
|
import moe.nea.firmament.gui.config.AllConfigsGui
|
||||||
import moe.nea.firmament.gui.config.BooleanHandler
|
import moe.nea.firmament.gui.config.BooleanHandler
|
||||||
import moe.nea.firmament.gui.config.ManagedConfig
|
import moe.nea.firmament.gui.config.ManagedConfig
|
||||||
@@ -217,6 +218,11 @@ fun firmamentCommand() = literal("firmament") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thenLiteral("blocks") {
|
||||||
|
thenExecute {
|
||||||
|
ScreenUtil.setScreenLater(MiningBlockInfoUi.makeScreen())
|
||||||
|
}
|
||||||
|
}
|
||||||
thenLiteral("dumpchat") {
|
thenLiteral("dumpchat") {
|
||||||
thenExecute {
|
thenExecute {
|
||||||
MC.inGameHud.chatHud.messages.forEach {
|
MC.inGameHud.chatHud.messages.forEach {
|
||||||
|
|||||||
54
src/main/kotlin/features/mining/MiningBlockInfoUi.kt
Normal file
54
src/main/kotlin/features/mining/MiningBlockInfoUi.kt
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package moe.nea.firmament.features.mining
|
||||||
|
|
||||||
|
import io.github.notenoughupdates.moulconfig.observer.ObservableList
|
||||||
|
import io.github.notenoughupdates.moulconfig.observer.Property
|
||||||
|
import io.github.notenoughupdates.moulconfig.platform.ModernItemStack
|
||||||
|
import io.github.notenoughupdates.moulconfig.xml.Bind
|
||||||
|
import net.minecraft.client.gui.screen.Screen
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import moe.nea.firmament.repo.MiningRepoData
|
||||||
|
import moe.nea.firmament.repo.RepoManager
|
||||||
|
import moe.nea.firmament.util.MoulConfigUtils
|
||||||
|
import moe.nea.firmament.util.SkyBlockIsland
|
||||||
|
|
||||||
|
object MiningBlockInfoUi {
|
||||||
|
class MiningInfo(miningData: MiningRepoData) {
|
||||||
|
@field:Bind("search")
|
||||||
|
@JvmField
|
||||||
|
var search = ""
|
||||||
|
|
||||||
|
@get:Bind("ores")
|
||||||
|
val blocks = miningData.customMiningBlocks.mapTo(ObservableList(mutableListOf())) { OreInfo(it, this) }
|
||||||
|
}
|
||||||
|
|
||||||
|
class OreInfo(block: MiningRepoData.CustomMiningBlock, info: MiningInfo) {
|
||||||
|
@get:Bind("oreName")
|
||||||
|
val oreName = block.name ?: "No Name"
|
||||||
|
|
||||||
|
@get:Bind("blocks")
|
||||||
|
val res = ObservableList(block.blocks189.map { BlockInfo(it, info) })
|
||||||
|
}
|
||||||
|
|
||||||
|
class BlockInfo(val block: MiningRepoData.Block189, val info: MiningInfo) {
|
||||||
|
@get:Bind("item")
|
||||||
|
val item = ModernItemStack.of(block.block?.let { ItemStack(it) } ?: ItemStack.EMPTY)
|
||||||
|
|
||||||
|
@get:Bind("isSelected")
|
||||||
|
val isSelected get() = info.search.let { block.isActiveIn(SkyBlockIsland.forMode(it)) }
|
||||||
|
|
||||||
|
@get:Bind("itemName")
|
||||||
|
val itemName get() = item.getDisplayName()
|
||||||
|
|
||||||
|
@get:Bind("restrictions")
|
||||||
|
val res = ObservableList(
|
||||||
|
if (block.onlyIn != null)
|
||||||
|
block.onlyIn.map { " §r- §a${it.userFriendlyName}" }
|
||||||
|
else
|
||||||
|
listOf("Everywhere")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun makeScreen(): Screen {
|
||||||
|
return MoulConfigUtils.loadScreen("mining_block_info/index", MiningInfo(RepoManager.miningData), null)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<Root xmlns="http://notenoughupdates.org/moulconfig"
|
||||||
|
xmlns:firm="http://firmament.nea.moe/moulconfig"
|
||||||
|
>
|
||||||
|
<Gui>
|
||||||
|
<Column>
|
||||||
|
<Row>
|
||||||
|
<Text text="Search: "/>
|
||||||
|
<TextField value="@search"/>
|
||||||
|
</Row>
|
||||||
|
<ScrollPanel width="200" height="150">
|
||||||
|
<Array data="@ores">
|
||||||
|
<Column>
|
||||||
|
<Text text="@oreName"/>
|
||||||
|
<Array data="@blocks">
|
||||||
|
<Row>
|
||||||
|
<When condition="@isSelected">
|
||||||
|
<Center>
|
||||||
|
<Text text="§a+" textAlign="CENTER" width="10"/>
|
||||||
|
</Center>
|
||||||
|
<Spacer width="10" height="0"/>
|
||||||
|
</When>
|
||||||
|
<firm:Hover lines="@restrictions">
|
||||||
|
<Row>
|
||||||
|
<ItemStack value="@item"/>
|
||||||
|
<Align horizontal="LEFT" vertical="CENTER">
|
||||||
|
<Text text="@itemName"/>
|
||||||
|
</Align>
|
||||||
|
</Row>
|
||||||
|
</firm:Hover>
|
||||||
|
</Row>
|
||||||
|
</Array>
|
||||||
|
</Column>
|
||||||
|
</Array>
|
||||||
|
</ScrollPanel>
|
||||||
|
</Column>
|
||||||
|
</Gui>
|
||||||
|
</Root>
|
||||||
Reference in New Issue
Block a user