fix: Some repo exporter inconsistencies
This commit is contained in:
@@ -28,6 +28,7 @@ import moe.nea.firmament.util.removeColorCodes
|
|||||||
import moe.nea.firmament.util.skyBlockId
|
import moe.nea.firmament.util.skyBlockId
|
||||||
import moe.nea.firmament.util.skyblock.SkyBlockItems
|
import moe.nea.firmament.util.skyblock.SkyBlockItems
|
||||||
import moe.nea.firmament.util.tr
|
import moe.nea.firmament.util.tr
|
||||||
|
import moe.nea.firmament.util.unformattedString
|
||||||
import moe.nea.firmament.util.useMatch
|
import moe.nea.firmament.util.useMatch
|
||||||
|
|
||||||
object ExportRecipe {
|
object ExportRecipe {
|
||||||
@@ -43,6 +44,7 @@ object ExportRecipe {
|
|||||||
(yNames[y].toString() + xNames[x].toString()) to x + y * 9 + 10
|
(yNames[y].toString() + xNames[x].toString()) to x + y * 9 + 10
|
||||||
}
|
}
|
||||||
val resultSlot = 25
|
val resultSlot = 25
|
||||||
|
val craftingTableSlut = resultSlot - 2
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
fun exportNpcLocation(event: WorldKeyboardEvent) {
|
fun exportNpcLocation(event: WorldKeyboardEvent) {
|
||||||
@@ -87,7 +89,8 @@ object ExportRecipe {
|
|||||||
}
|
}
|
||||||
val title = event.screen.title.string
|
val title = event.screen.title.string
|
||||||
val sellSlot = event.screen.getSlotByIndex(49, false)?.stack
|
val sellSlot = event.screen.getSlotByIndex(49, false)?.stack
|
||||||
if (title.endsWith(" Recipe")) {
|
val craftingTableSlot = event.screen.getSlotByIndex(craftingTableSlut, false)
|
||||||
|
if (craftingTableSlot?.stack?.displayNameAccordingToNbt?.unformattedString == "Crafting Table") {
|
||||||
slotIndices.forEach { (_, index) ->
|
slotIndices.forEach { (_, index) ->
|
||||||
event.screen.getSlotByIndex(index, false)?.stack?.let(ItemExporter::ensureExported)
|
event.screen.getSlotByIndex(index, false)?.stack?.let(ItemExporter::ensureExported)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ object ItemExporter {
|
|||||||
|
|
||||||
fun ensureExported(itemStack: ItemStack) {
|
fun ensureExported(itemStack: ItemStack) {
|
||||||
if (!isExported(itemStack.skyBlockId ?: return))
|
if (!isExported(itemStack.skyBlockId ?: return))
|
||||||
exportItem(itemStack)
|
MC.sendChat(exportItem(itemStack))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun modifyJson(skyblockId: SkyblockId, modify: (JsonObject) -> JsonObject) {
|
fun modifyJson(skyblockId: SkyblockId, modify: (JsonObject) -> JsonObject) {
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) {
|
|||||||
string = string.replace("Lvl \\d+".toRegex(), "Lvl {LVL}")
|
string = string.replace("Lvl \\d+".toRegex(), "Lvl {LVL}")
|
||||||
Text.literal(string).setStyle(it.style)
|
Text.literal(string).setStyle(it.style)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lore.isEmpty())
|
||||||
|
lore = listOf(Text.empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun trimStats() {
|
private fun trimStats() {
|
||||||
@@ -162,6 +165,7 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) {
|
|||||||
fun prepare() {
|
fun prepare() {
|
||||||
preprocess()
|
preprocess()
|
||||||
processNbt()
|
processNbt()
|
||||||
|
itemStack.extraAttributes = extraAttribs
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exportJson(): JsonElement {
|
fun exportJson(): JsonElement {
|
||||||
|
|||||||
Reference in New Issue
Block a user