Suggested changes

Signed-off-by: scorbett123 <50634068+scorbett123@users.noreply.github.com>
This commit is contained in:
scorbett123 2021-03-06 11:55:20 +00:00
parent d7d5263825
commit 91bfeda0d8
3 changed files with 8 additions and 6 deletions

View File

@ -88,7 +88,6 @@ abstract class AbstractKamiGui<S : SettingWindow<*>, E : Any> : GuiScreen() {
mc = Wrapper.minecraft
windowList.add(ColorPicker)
windowList.add(BlockPicker)
BlockPicker.visible = false
safeListener<TickEvent.ClientTickEvent> { event ->
if (event.phase != TickEvent.Phase.START) return@safeListener

View File

@ -16,6 +16,10 @@ object BlockPicker : ListWindow("Block Picker", 0.0f, 0.0f, 200.0f, 200.0f, Sett
val blocks = Block.REGISTRY.keys.asSequence().map { Block.REGISTRY.getObject(ResourceLocation(it.path)) }.distinctBy { it.localizedName }.filter { !it.localizedName.startsWith("tile") }.sortedBy { it.localizedName.toLowerCase() }.toList()
init {
visible = false
}
override fun onDisplayed() {
super.onDisplayed()

View File

@ -18,11 +18,10 @@ class BlockSetting(
override fun read(jsonElement: JsonElement?) {
jsonElement?.asJsonPrimitive?.asString.let {
for (block in BlockPicker.blocks) {
if (block.translationKey == it) {
value = block
break
}
BlockPicker.blocks.find { block ->
block.translationKey == it
}?.let { block ->
value = block
}
}
}