Skip to content

Releases: SilkMC/silk

1.2.0

20 Aug 01:45
adfd3f8
Compare
Choose a tag to compare

New features

fabrikmc-nbt module

Thanks to @F0Xde, the new nbt module brings nbt serialization with kotlinx.serialization, an nbt builder and nbt conversion.

For serialization simply annotate a class with @Serializable and use your kotlinx.serialization features as usual.

For encoding and decoding, use:

Nbt.encodeToNbtElement(value)
Nbt.decodeFromNbtElement<T>(nbtElement)

The nbt dsl works as follows:

val compound = nbtCompound {
    put("age", 32)
    put("name", "John")
    list("friends") {
        add("Peter")
    }
}

fabrikmc-persistence module

The persistence module allows you to store data persistently on holders like Chunks, Entities and more. Additionally, this module makes use of the nbt module and allows you to store any class annotated with @serializable on your persistent data holders.

@Serializable
private data class Person(val name: String, val age: Int, val friends: List<String>)

// specify the key
private val personKey by compoundKey<Person>()

// to save the data
fun Player.storePerson() {
    persistentCompound.let {
        it[personKey] = Person(
            "John",
            32,
            listOf("Peter", "James", "Sofia")
        )
    }
}

// to read the data
fun Player.loadPerson() = persistentCompound[personKey]

Brigardier wrapper improvements

The Brigardier wrapper now allows you to skip passing the argument type to argument builders for simple types by using a reified generic type instead.

Additionally, you can now use the resolveArgument() function to resolve arguments without having to specify their names.

For a single argument:

argument<String>("name") {
    simpleExecutes {
        val name = resolveArgument()
    }
}

Or for multiple arguments:

argument<String>("name") name@{
    argument<Int>("age") age@{
        simpleExecutes {
            val name = this@name.resolveArgument()
            val age = this@age.resolveArgument()
        }
    }
}

Furthermore, the Brigardier wrapper now supports chaining of the argument and literal functions.

Sideboard API

You can now easily create sideboards with changing content. The sideboards make use of kotlinx.coroutines flows, this means that the update logic is very flexible.

A simple example would be:

sideboard(
        literalText("Simple Sideboard") { color = 0x6DFF41 }
) {
        literalLine("Hey, how")
        literalLine("are you?")
        literalLine(" ")
        lineChangingPeriodically(1000) {
            literalText("changing color") {
                color = (0x000000..0xFFFFFF).random()
            }
        }
}

the coroutineTask function

In the scope of the function, you now have access to the following values:

  • round
  • roundFromZero
  • counterDownToOne
  • counterDownToZero

Packets

You can now send packets to an Iterable of Players using Iterable<ServerPlayerEntity>::sendPacket.

Position conversion class

The FabrikPosition class now supports even more types of Positions and Locations, e.g. ChunkSectionPos and more.

Internal changes

  • mcCoroutineScope and fabrikCoroutineScope now use a SupervisorJob to change the behaviour when exceptions are thrown
  • mixins no longer target the server exclusively

Breaking Changes

  • a CoroutineTask can now be cancelled using the cancel() function provided by kotlinx.coroutines
  • the default for the register parameter of the command function is now set to true
  • the simpleExecutes function of the Brigardier wrapper now passes the command context as this instead of it

1.1.0

15 Jul 16:21
e43d72a
Compare
Choose a tag to compare
  • added Scoreboard class
  • update to 1.17.1

1.0.0

08 Jun 17:21
45b2ac8
Compare
Choose a tag to compare
  • now for Minecraft 1.17
  • improved text builder (e.g. added emptyLine())
  • added more text builder extensions
  • support for fully client side commands
  • improved internal build setup

0.4.2-SNAPSHOT

24 May 13:58
2f0f99b
Compare
Choose a tag to compare
0.4.2-SNAPSHOT Pre-release
Pre-release
Merge pull request #7 from bluefireoly/scoreboard

Update main

0.4.1

20 May 19:57
370845e
Compare
Choose a tag to compare
Merge pull request #5 from bluefireoly/scoreboard

Imrove Gui api

0.4.0

20 May 15:15
370845e
Compare
Choose a tag to compare
Merge pull request #5 from bluefireoly/scoreboard

Imrove Gui api

0.3.5

09 May 18:17
Compare
Choose a tag to compare
Update BuildConstants.kt

0.3.4

10 Apr 19:37
3ed18b7
Compare
Choose a tag to compare
Stick to the bundled version of minecraft

0.3.3

31 Mar 13:53
eec5712
Compare
Choose a tag to compare
Update BuildConstants.kt

0.3.2

26 Mar 20:36
1232795
Compare
Choose a tag to compare
Update log messages