Skip to content

Commit

Permalink
formatting,
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed May 26, 2024
1 parent b01000e commit d04190e
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/test/CopyChestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object CopyChestData {
}
}
config.copyPlayerInventory.isKeyHeld() -> {
copyInventoryData(inventory = if (config.includeArmor) mc.thePlayer.inventory.mainInventory + mc.thePlayer.inventory.armorInventory else mc.thePlayer.inventory.mainInventory)
copyInventoryData(inventory = if (config.includeArmor) (mc.thePlayer.inventory.mainInventory + mc.thePlayer.inventory.armorInventory) else mc.thePlayer.inventory.mainInventory)
}
config.copyChestName.isKeyHeld() -> {
if (InventoryUtils.openInventoryName().isNotEmpty()) {
Expand All @@ -41,12 +41,35 @@ object CopyChestData {
}
}
private fun copyInventoryData(inventory: Array<ItemStack?>) {
val copyList = mutableListOf<String>("relevant config:", "includeNullSlots: ${config.includeNullSlots}", "includeUnnamedItems: ${config.includeUnnamedItems}", "includeArmor: ${config.includeArmor}", "", "your inventory is below.", "", "your hotbar:", "")
val copyList = mutableListOf<String>(
"relevant config:",
"includeNullSlots: ${config.includeNullSlots}",
"includeUnnamedItems: ${config.includeUnnamedItems}",
"includeArmor: ${config.includeArmor}",
"",
"your inventory is below.",
"",
"your hotbar:",
""
)
for ((i, stack) in inventory.withIndex()) {
if (i == HOTBAR_SIZE) copyList.addAll(listOf("note: hotbar ends here", "the rest of your inventory:", "", ""))
if (i == HOTBAR_SIZE) copyList.addAll(
listOf(
"note: hotbar ends here",
"the rest of your inventory:",
"",
""
)
)
if (i == HOTBAR_SIZE + INVENTORY_SIZE && config.includeArmor) copyList.addAll(listOf("note: the rest of your inventory data ends here", "your armor:", "", ""))
if (stack == null) {
if (config.includeNullSlots) copyList.addAll(listOf("(slot $i is null)", "", ""))
if (config.includeNullSlots) copyList.addAll(
listOf(
"(slot $i is null)",
"",
""
)
)
continue
}
if (stack.displayName.isNotBlank() || config.includeUnnamedItems) {
Expand All @@ -58,7 +81,15 @@ object CopyChestData {
ChatUtils.chat("Inventory $DEBUG_SUFFIX")
}
private fun copyChestData(chest: List<Slot>) {
val copyList = mutableListOf<String>("relevant config:", "includeNullSlots: ${config.includeNullSlots}", "includeUnnamedItems: ${config.includeUnnamedItems}", "includeArmor: ${config.includeArmor}", "", "chest name: '${InventoryUtils.openInventoryName()}'", "")
val copyList = mutableListOf<String>(
"relevant config:",
"includeNullSlots: ${config.includeNullSlots}",
"includeUnnamedItems: ${config.includeUnnamedItems}",
"includeArmor: ${config.includeArmor}",
"",
"chest name: '${InventoryUtils.openInventoryName()}'",
""
)
for (slot in chest) {
val stack = slot.stack
if (stack == null) {
Expand Down Expand Up @@ -87,7 +118,13 @@ object CopyChestData {
)
)
addAll(grabItemData(itemStack))
addAll(listOf<String>(" ]", "}", ""))
addAll(
listOf<String>(
" ]",
"}",
""
)
)
}
}
}

0 comments on commit d04190e

Please sign in to comment.