feat: Refactor Pokémon loading to include empty slot checks and add a new README file.

This commit is contained in:
2025-12-12 23:23:49 +00:00
parent 1d9a551350
commit 88c155d239
4 changed files with 312 additions and 101 deletions

View File

@@ -30,27 +30,28 @@ class CobbleSyncScreen : Screen(Component.literal("CobbleSync")) {
val centerY = height / 2
// Sync Button - uploads Box 30 to the server
syncButton = Button.builder(Component.literal("⬆ Sync Box 30")) { _ ->
setStatus(Component.literal("Syncing..."), 0xFFFF55)
ClientPlayNetworking.send(CobbleSyncPackets.SyncRequestPayload())
}
.bounds(centerX - buttonWidth / 2, centerY - 40, buttonWidth, buttonHeight)
.build()
syncButton =
Button.builder(Component.literal("Sync Box 30")) { _ ->
setStatus(Component.literal("Syncing..."), 0xFFFF55)
ClientPlayNetworking.send(CobbleSyncPackets.SyncRequestPayload())
}
.bounds(centerX - buttonWidth / 2, centerY - 40, buttonWidth, buttonHeight)
.build()
// Load Button - downloads saved Pokemon to Box 1
loadButton = Button.builder(Component.literal("⬇ Load to Box 1")) { _ ->
setStatus(Component.literal("Loading..."), 0xFFFF55)
ClientPlayNetworking.send(CobbleSyncPackets.LoadRequestPayload())
}
.bounds(centerX - buttonWidth / 2, centerY - 10, buttonWidth, buttonHeight)
.build()
// Load Button - downloads saved Pokemon to empty slots
loadButton =
Button.builder(Component.literal("Load Pokémon")) { _ ->
setStatus(Component.literal("Loading..."), 0xFFFF55)
ClientPlayNetworking.send(CobbleSyncPackets.LoadRequestPayload())
}
.bounds(centerX - buttonWidth / 2, centerY - 10, buttonWidth, buttonHeight)
.build()
// Close Button
closeButton = Button.builder(Component.literal("Close")) { _ ->
onClose()
}
.bounds(centerX - buttonWidth / 2, centerY + 30, buttonWidth, buttonHeight)
.build()
closeButton =
Button.builder(Component.literal("Close")) { _ -> onClose() }
.bounds(centerX - buttonWidth / 2, centerY + 30, buttonWidth, buttonHeight)
.build()
addRenderableWidget(syncButton)
addRenderableWidget(loadButton)
@@ -63,56 +64,56 @@ class CobbleSyncScreen : Screen(Component.literal("CobbleSync")) {
// Draw title
guiGraphics.drawCenteredString(
font,
Component.literal("§6§lCobbleSync"),
width / 2,
height / 2 - 80,
0xFFFFFF
font,
Component.literal("§6§lCobbleSync"),
width / 2,
height / 2 - 80,
0xFFFFFF
)
// Draw subtitle/description
guiGraphics.drawCenteredString(
font,
Component.literal("§7Sync your Pokémon across servers"),
width / 2,
height / 2 - 65,
0xAAAAAA
font,
Component.literal("§7Sync your Pokémon across servers"),
width / 2,
height / 2 - 65,
0xAAAAAA
)
// Draw separator line
guiGraphics.fill(
width / 2 - 100,
height / 2 - 55,
width / 2 + 100,
height / 2 - 54,
0xFF444444.toInt()
width / 2 - 100,
height / 2 - 55,
width / 2 + 100,
height / 2 - 54,
0xFF444444.toInt()
)
// Draw status message
if (statusMessage.string.isNotEmpty()) {
guiGraphics.drawCenteredString(
font,
statusMessage,
width / 2,
height / 2 + 60,
statusColor
font,
statusMessage,
width / 2,
height / 2 + 60,
statusColor
)
}
// Draw info text
guiGraphics.drawCenteredString(
font,
Component.literal("§8Sync: Upload Box 30 (max 12 Pokémon)"),
width / 2,
height / 2 + 80,
0x888888
font,
Component.literal("§8Sync: Upload Box 30 (max 12 Pokémon)"),
width / 2,
height / 2 + 80,
0x888888
)
guiGraphics.drawCenteredString(
font,
Component.literal("§8Load: Download to Box 1 (must be empty)"),
width / 2,
height / 2 + 92,
0x888888
font,
Component.literal("§8Load: Download to empty PC slots"),
width / 2,
height / 2 + 92,
0x888888
)
super.render(guiGraphics, mouseX, mouseY, partialTick)