ModsJava
Steve's Series | Gui Library
> Gui Library < THIS PLUGIN REQUIRES Steve's Series | Kotlin The most (or at least one of) advanced GUI management library. Unlike other GUI libraries…
⬇ Download on Spigot
The most (or at least one of) advanced GUI management library. Unlike other GUI libraries, SS-GuiLibrary supports any kind of GUI, in addition to inventory GUIs, while not currently supported by the library itself, it is entirely possible to create a kind of GUI that would use books instead, as an example. SS-GuiLibrary uses Kotlin for most of it's functions, while it is possible to use it from Java, I highly recommend Kotlin as there are a lot of things with this plugin that would not be as clean of solutions in Java as they can be in Kotlin. The most powerful part of this library is the GuiComponents with their state management.
There are multiple ways in which you can create a chest GUI with this library:
There are multiple ways in which you can create a chest GUI with this library:
- Using InventoryGuiController (I do not know any cases in which you would want to use this, unless building a custom solution):
Code (Kotlin):class TestGui : InventoryGuiController ( ) {
override fun createInventory ( ) = this. player. server. createInventory ( null, 9, "Test GUI" )
override fun update ( ) {
val stack = ItemStack (Material. EMERALD_BLOCK )
val meta = stack. itemMeta
meta. setDisplayName ( "Test" )
stack. itemMeta = meta
this. inventory. setItem ( 0, stack )
}
override fun onClick (event : InventoryClickEvent ) {
event. isCancelled = true
if (event. clickedInventory != this. inventory || event. click == ClickType. DOUBLE_CLICK ) {
return
}
if (event. click. isLeftClick && event. slot == 0 ) {
this. player. sendMessage ( "Hello, world!" )
}
}
override fun onDrag (event : InventoryDragEvent ) {
event. isCancelled = true
}
} - Using GridInventoryGui (best for simple GUIs):
Code (Kotlin):class TestGui : GridInventoryGui ( ) {
override fun getSize ( ) = GridInventorySize. GENERIC_9X1
override fun getTitle ( ) = "Test GUI"
override fun render (canvas : ItemCanvas ) {
canvas. item ( 0, 0 ) {
stack { type = Material. EMERALD_BLOCK }
meta <ItemMeta > { setDisplayName ( "Test" ) }
leftClick { _, _, _, _ ->
this@TestGui. player. sendMessage ( "Hello, world!" )
}
}
}
} - Using ComponentGui and GuiComponents (best solution, but less performant than the previous two):
Code (Kotlin):class TestGui : GuiComponent ( ), RootComponent {
override fun getSize ( ) = GridInventorySize. GENERIC_9X1
override fun getTitle ( ) = "Test GUI"
override fun ComponentCanvas. render ( ) {
item ( 0, 0 ) {
stack { type = Material. EMERALD_BLOCK }
meta <ItemMeta > { setDisplayName ( "Test" ) }
leftClick { _, _, _, _ ->
this@TestGui. gui. player. sendMessage ( "Hello, world!" )
}
}
}
}
Code (Kotlin):
class PlayerInfoComponent
(
private val player : Player
) : GuiComponent ( ) {
private fun getMaxHealth ( ) =
this@PlayerInfoComponent. player. getAttribute ( Attribute. GENERIC_MAX_HEALTH ) ?. value
override fun ComponentCanvas. render ( ) {
val playerName = this@PlayerInfoComponent. player. name // The name of a player cannot change, no need to watch it.
val playerHealth = watch { this@PlayerInfoComponent. player. health }
val playerMaxHealth = watch { this@PlayerInfoComponent. getMaxHealth ( ) }
item ( 0, 0 ) {
stack { type = Material. PLAYER_HEAD }
meta <SkullMeta > {
setDisplayName ( "${ChatColor.WHITE}$playerName" )
lore = listOf (
"",
"${ChatColor.GRAY}Health: ${ChatColor.YELLOW}$playerHealth/${ChatColor.YELLOW}$playerMaxHealth"
)
}
}
}
}
class SelfInfoComponent : GuiComponent ( ), RootComponent {
override fun getSize ( ) = GridInventorySize. HOPPER
override fun getTitle ( ) = "Your Player Info"
override fun ComponentCanvas. render ( ) {
val player = this@SelfInfoComponent. gui. player
component ( 2, 0, 1, 1, PlayerInfoComponent (player ) )
}
}
private val player : Player
) : GuiComponent ( ) {
private fun getMaxHealth ( ) =
this@PlayerInfoComponent. player. getAttribute ( Attribute. GENERIC_MAX_HEALTH ) ?. value
override fun ComponentCanvas. render ( ) {
val playerName = this@PlayerInfoComponent. player. name // The name of a player cannot change, no need to watch it.
val playerHealth = watch { this@PlayerInfoComponent. player. health }
val playerMaxHealth = watch { this@PlayerInfoComponent. getMaxHealth ( ) }
item ( 0, 0 ) {
stack { type = Material. PLAYER_HEAD }
meta <SkullMeta > {
setDisplayName ( "${ChatColor.WHITE}$playerName" )
lore = listOf (
"",
"${ChatColor.GRAY}Health: ${ChatColor.YELLOW}$playerHealth/${ChatColor.YELLOW}$playerMaxHealth"
)
}
}
}
}
class SelfInfoComponent : GuiComponent ( ), RootComponent {
override fun getSize ( ) = GridInventorySize. HOPPER
override fun getTitle ( ) = "Your Player Info"
override fun ComponentCanvas. render ( ) {
val player = this@SelfInfoComponent. gui. player
component ( 2, 0, 1, 1, PlayerInfoComponent (player ) )
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft version listed: 1.18
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Steve's Series | Gui Library is a free Minecraft Java mod. Compatible with Minecraft 1.18. Downloaded 518 times (via Spigot). Download it and open it directly in the game.