Skip to content

Commit

Permalink
chore: bump idofront, geary & guiy
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed May 31, 2024
1 parent 03f96c2 commit 4b9c040
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
alias(idofrontLibs.plugins.mia.copyjar)
alias(idofrontLibs.plugins.mia.publication)
alias(idofrontLibs.plugins.mia.autoversion)
alias(idofrontLibs.plugins.compose)
alias(idofrontLibs.plugins.compose.compiler)
id("net.minecrell.plugin-yml.paper") version "0.6.0"
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=0.9
idofrontVersion=0.24.0-dev.8
idofrontVersion=0.24.0
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
gearyPaper = "0.30.1-dev.16"
guiy="0.9.4"
gearyPaper = "0.30.1"
guiy="0.10.0"

[libraries]
geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" }
guiy = { module = "com.mineinabyss:guiy-compose", version.ref = "guiy" }

minecraft-plugin-customblockdata = "com.jeff-media:custom-block-data:2.2.2"
minecraft-plugin-protectionlib = "io.th0rgal:protectionlib:1.5.7"
minecraft-plugin-protectionlib = "io.th0rgal:protectionlib:1.5.8"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
import com.mineinabyss.guiy.components.canvases.LocalInventory
import com.mineinabyss.guiy.layout.Row
import com.mineinabyss.guiy.modifiers.Modifier
import com.mineinabyss.guiy.modifiers.clickable
import com.mineinabyss.guiy.modifiers.click.clickable
import org.bukkit.Sound
import org.bukkit.entity.Player

Expand All @@ -17,12 +17,9 @@ inline fun Button(
crossinline content: @Composable (enabled: Boolean) -> Unit,
) {
val inv = LocalInventory.current
Row(modifier.clickable { //TODO clickable should pass player
val viewers = inv.viewers.filterIsInstance<Player>()
if (playSound) {
if (enabled) viewers.forEach { it.playSound(it.location, Sound.ITEM_ARMOR_EQUIP_GENERIC, 1f, 1f) }
else viewers.forEach { it.playSound(it.location, Sound.BLOCK_LEVER_CLICK, 1f, 1f) }
}
Row(modifier.clickable {
val player = whoClicked as? Player ?: return@clickable
if (playSound) player.playSound(player.location, if (enabled) Sound.ITEM_ARMOR_EQUIP_GENERIC else Sound.BLOCK_LEVER_CLICK, 1f, 1f)
if (enabled) onClick()
}) {
content(enabled)
Expand Down
22 changes: 11 additions & 11 deletions src/main/kotlin/com/mineinabyss/blocky/menus/BlockyMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.mineinabyss.geary.prefabs.PrefabKey
import com.mineinabyss.guiy.components.Item
import com.mineinabyss.guiy.modifiers.Modifier
import com.mineinabyss.guiy.modifiers.at
import com.mineinabyss.guiy.modifiers.clickable
import com.mineinabyss.guiy.modifiers.click.clickable
import org.bukkit.entity.Player
import org.bukkit.event.inventory.ClickType

Expand All @@ -34,18 +34,18 @@ fun HandleMenuClicks(key: PrefabKey, player: Player) {
val block = gearyItems.createItem(key)
Item(block, Modifier.clickable {
when (clickType) {
ClickType.LEFT -> {
if (cursor == null) cursor = block
else if (player.gearyInventory?.itemOnCursor == key.toEntity()) cursor?.add(1)
else cursor = block?.asQuantity(1)
ClickType.LEFT -> when {
cursor == null -> whoClicked.setItemOnCursor(block)
player.gearyInventory?.itemOnCursor?.prefabs?.first()?.get<PrefabKey>() == key -> cursor?.add(1)
else -> whoClicked.setItemOnCursor(block?.asQuantity(1))
}
ClickType.RIGHT -> {
if (cursor == null) cursor = block?.asQuantity(1)
else cursor?.subtract(1)
ClickType.RIGHT -> when (cursor) {
null -> whoClicked.setItemOnCursor(block?.asQuantity(1))
else -> cursor?.subtract(1)
}
ClickType.MIDDLE -> cursor = block?.asQuantity(block.maxStackSize)
ClickType.SHIFT_LEFT -> cursor = block?.asQuantity(block.maxStackSize)
ClickType.SHIFT_RIGHT -> cursor = block?.asQuantity(block.maxStackSize)
ClickType.MIDDLE -> whoClicked.setItemOnCursor(block?.asQuantity(block.maxStackSize))
ClickType.SHIFT_LEFT -> whoClicked.setItemOnCursor(block?.asQuantity(block.maxStackSize))
ClickType.SHIFT_RIGHT -> whoClicked.setItemOnCursor(block?.asQuantity(block.maxStackSize))
ClickType.DROP -> block?.let { player.world.dropItemNaturally(player.location, it) }
ClickType.CONTROL_DROP -> block?.asQuantity(block.maxStackSize)?.let { player.world.dropItemNaturally(player.location, it) }
else -> return@clickable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.mineinabyss.blocky.helpers.composables.Button
import com.mineinabyss.guiy.components.Item
import com.mineinabyss.guiy.components.canvases.Chest
import com.mineinabyss.guiy.inventory.GuiyOwner
import com.mineinabyss.guiy.inventory.LocalGuiyOwner
import com.mineinabyss.guiy.modifiers.Modifier
import com.mineinabyss.guiy.modifiers.height
import com.mineinabyss.guiy.navigation.Navigator
Expand All @@ -30,9 +31,10 @@ class BlockyUIScope(val player: Player) {
}

@Composable
fun GuiyOwner.BlockyMainMenu(player: Player) {
fun BlockyMainMenu(player: Player) {
val owner = LocalGuiyOwner.current
BlockyUIScope(player).apply {
nav.withScreen(setOf(player), onEmpty = ::exit) { screen ->
nav.withScreen(setOf(player), onEmpty = owner::exit) { screen ->
Chest(setOf(player), screen.title,
Modifier.height(screen.height),
onClose = { player.closeInventory() }) {
Expand Down

0 comments on commit 4b9c040

Please sign in to comment.