Rename project to Uranos
This commit is contained in:
parent
32103d695a
commit
d46675dff3
237 changed files with 798 additions and 822 deletions
|
@ -1,12 +1,12 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Run" type="JetRunConfigurationType">
|
<configuration default="false" name="Run" type="JetRunConfigurationType">
|
||||||
<module name="blokk.blokk-server.main" />
|
<module name="uranos.uranos-server.main" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH" />
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PASS_PARENT_ENVS" value="true" />
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="MAIN_CLASS_NAME" value="space.blokk.BlokkServer" />
|
<option name="MAIN_CLASS_NAME" value="space.uranos.UranosServer" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 The Blokk contributors
|
Copyright (c) 2021 Moritz Ruth and the Uranos contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Blokk
|
# Uranos
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package space.blokk
|
|
||||||
|
|
||||||
import space.blokk.server.Server
|
|
||||||
|
|
||||||
private lateinit var serverInstance: Server
|
|
||||||
|
|
||||||
object Blokk : Server by serverInstance
|
|
|
@ -1,7 +0,0 @@
|
||||||
package space.blokk.net.event
|
|
||||||
|
|
||||||
import space.blokk.event.Event
|
|
||||||
import space.blokk.event.TargetedEvent
|
|
||||||
import space.blokk.net.Session
|
|
||||||
|
|
||||||
abstract class SessionEvent : TargetedEvent<Session>()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package space.blokk.player.event
|
|
||||||
|
|
||||||
import space.blokk.event.Event
|
|
||||||
import space.blokk.player.Player
|
|
||||||
|
|
||||||
abstract class PlayerEvent(val player: Player) : Event()
|
|
|
@ -1,5 +0,0 @@
|
||||||
package space.blokk.server.event
|
|
||||||
|
|
||||||
import space.blokk.event.Event
|
|
||||||
|
|
||||||
abstract class ServerEvent : Event()
|
|
|
@ -1,5 +0,0 @@
|
||||||
package space.blokk.net.packet.handshaking
|
|
||||||
|
|
||||||
import space.blokk.net.packet.Protocol
|
|
||||||
|
|
||||||
object HandshakingProtocol : Protocol("HANDSHAKING", HandshakePacketCodec)
|
|
|
@ -1,6 +0,0 @@
|
||||||
package space.blokk.net.packet.play
|
|
||||||
|
|
||||||
import space.blokk.command.Command
|
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
|
||||||
|
|
||||||
data class DeclareCommandsPacket(val commands: Collection<Command>) : OutgoingPacket()
|
|
|
@ -1,10 +0,0 @@
|
||||||
package space.blokk.net.packet.play
|
|
||||||
|
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sent by the server when the connection is closed.
|
|
||||||
*
|
|
||||||
* @param reason The reason displayed to the client.
|
|
||||||
*/
|
|
||||||
data class DisconnectPacket(val reason: space.blokk.chat.TextComponent) : OutgoingPacket()
|
|
|
@ -1,5 +0,0 @@
|
||||||
package space.blokk.net.packet.play
|
|
||||||
|
|
||||||
import space.blokk.net.packet.IncomingPacket
|
|
||||||
|
|
||||||
data class IncomingKeepAlivePacket(val id: Long) : IncomingPacket()
|
|
|
@ -1,5 +0,0 @@
|
||||||
package space.blokk.net.packet.play
|
|
||||||
|
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
|
||||||
|
|
||||||
data class OutgoingKeepAlivePacket(val id: Long) : OutgoingPacket()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package space.blokk.net.packet.play
|
|
||||||
|
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
|
||||||
import space.blokk.world.VoxelLocation
|
|
||||||
|
|
||||||
data class SetCompassTargetPacket(val target: VoxelLocation) : OutgoingPacket()
|
|
|
@ -6,7 +6,7 @@ plugins {
|
||||||
id("minecraft-data-sources")
|
id("minecraft-data-sources")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "space.blokk"
|
group = "space.uranos"
|
||||||
version = "0.0.1-SNAPSHOT"
|
version = "0.0.1-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
@ -29,7 +29,7 @@ gradlePlugin {
|
||||||
plugins {
|
plugins {
|
||||||
create("minecraft-data-sources") {
|
create("minecraft-data-sources") {
|
||||||
id = "minecraft-data-sources"
|
id = "minecraft-data-sources"
|
||||||
implementationClass = "space.blokk.mdsp.MinecraftDataSourcesPlugin"
|
implementationClass = "space.uranos.mdsp.MinecraftDataSourcesPlugin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.mdsp
|
package space.uranos.mdsp
|
||||||
|
|
||||||
const val PRISMARINE_BASE_URL = "https://raw.githubusercontent.com/PrismarineJS/minecraft-data/master/data/pc/"
|
const val PRISMARINE_BASE_URL = "https://raw.githubusercontent.com/PrismarineJS/minecraft-data/master/data/pc/"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.mdsp
|
package space.uranos.mdsp
|
||||||
|
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.mdsp
|
package space.uranos.mdsp
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package space.blokk.mdsp
|
package space.uranos.mdsp
|
||||||
|
|
||||||
import com.jsoniter.JsonIterator
|
import com.jsoniter.JsonIterator
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import space.blokk.mdsp.generator.*
|
import space.uranos.mdsp.generator.*
|
||||||
|
|
||||||
class MinecraftDataSourcesPlugin : Plugin<Project> {
|
class MinecraftDataSourcesPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
val workingDir = project.file("buildSrcTemp")
|
val workingDir = project.file("buildSrcTemp")
|
||||||
val outputDir = project
|
val outputDir = project
|
||||||
.project(":blokk-api")
|
.project(":uranos-api")
|
||||||
.projectDir
|
.projectDir
|
||||||
.resolve("src/main/generatedKotlin")
|
.resolve("src/main/generatedKotlin")
|
||||||
|
|
||||||
val sourcesDir = project
|
val sourcesDir = project
|
||||||
.project(":blokk-api")
|
.project(":uranos-api")
|
||||||
.projectDir
|
.projectDir
|
||||||
.resolve("src/main/kotlin")
|
.resolve("src/main/kotlin")
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat
|
import com.google.common.base.CaseFormat
|
||||||
import com.jsoniter.JsonIterator
|
import com.jsoniter.JsonIterator
|
||||||
import com.squareup.kotlinpoet.*
|
import com.squareup.kotlinpoet.*
|
||||||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
||||||
import space.blokk.mdsp.JsonAny
|
import space.uranos.mdsp.JsonAny
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class BlocksAndMaterialGenerator(
|
class BlocksAndMaterialGenerator(
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.squareup.kotlinpoet.ClassName
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
|
||||||
const val BASE_PACKAGE = "space.blokk"
|
const val BASE_PACKAGE = "space.uranos"
|
||||||
const val WORLD_PACKAGE = "$BASE_PACKAGE.world"
|
const val WORLD_PACKAGE = "$BASE_PACKAGE.world"
|
||||||
const val BLOCK_PACKAGE = "$WORLD_PACKAGE.block"
|
const val BLOCK_PACKAGE = "$WORLD_PACKAGE.block"
|
||||||
const val ENTITY_PACKAGE = "$BASE_PACKAGE.entity"
|
const val ENTITY_PACKAGE = "$BASE_PACKAGE.entity"
|
|
@ -1,10 +1,10 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat
|
import com.google.common.base.CaseFormat
|
||||||
import com.jsoniter.JsonIterator
|
import com.jsoniter.JsonIterator
|
||||||
import com.squareup.kotlinpoet.*
|
import com.squareup.kotlinpoet.*
|
||||||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
||||||
import space.blokk.mdsp.JsonAny
|
import space.uranos.mdsp.JsonAny
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class EntitiesGenerator(
|
class EntitiesGenerator(
|
|
@ -1,11 +1,11 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat
|
import com.google.common.base.CaseFormat
|
||||||
import com.jsoniter.JsonIterator
|
import com.jsoniter.JsonIterator
|
||||||
import com.squareup.kotlinpoet.*
|
import com.squareup.kotlinpoet.*
|
||||||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import space.blokk.mdsp.JsonAny
|
import space.uranos.mdsp.JsonAny
|
||||||
|
|
||||||
class FluidIDMapGenerator(
|
class FluidIDMapGenerator(
|
||||||
private val workingDir: File,
|
private val workingDir: File,
|
|
@ -1,11 +1,11 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat
|
import com.google.common.base.CaseFormat
|
||||||
import com.squareup.kotlinpoet.*
|
import com.squareup.kotlinpoet.*
|
||||||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import space.blokk.mdsp.util.ConstructorPropertiesHelper
|
import space.uranos.mdsp.util.ConstructorPropertiesHelper
|
||||||
import space.blokk.mdsp.JsonAny
|
import space.uranos.mdsp.JsonAny
|
||||||
|
|
||||||
class ItemTypeEnumGenerator(
|
class ItemTypeEnumGenerator(
|
||||||
private val workingDir: File,
|
private val workingDir: File,
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.mdsp.generator
|
package space.uranos.mdsp.generator
|
||||||
|
|
||||||
import com.jsoniter.JsonIterator
|
import com.jsoniter.JsonIterator
|
||||||
import com.squareup.kotlinpoet.*
|
import com.squareup.kotlinpoet.*
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.mdsp.util
|
package space.uranos.mdsp.util
|
||||||
|
|
||||||
import com.squareup.kotlinpoet.ParameterSpec
|
import com.squareup.kotlinpoet.ParameterSpec
|
||||||
import com.squareup.kotlinpoet.PropertySpec
|
import com.squareup.kotlinpoet.PropertySpec
|
|
@ -5,11 +5,11 @@ pluginManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "blokk"
|
rootProject.name = "uranos"
|
||||||
|
|
||||||
include(":blokk-api")
|
include(":uranos-api")
|
||||||
include(":blokk-nbt")
|
include(":uranos-nbt")
|
||||||
include(":blokk-packet-codecs")
|
include(":uranos-packet-codecs")
|
||||||
include(":blokk-packets")
|
include(":uranos-packets")
|
||||||
include(":blokk-server")
|
include(":uranos-server")
|
||||||
include("test-plugin")
|
include(":test-plugin")
|
||||||
|
|
|
@ -3,7 +3,7 @@ plugins {
|
||||||
id("com.github.johnrengelman.shadow") version "6.1.0"
|
id("com.github.johnrengelman.shadow") version "6.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "space.blokk.testplugin"
|
group = "space.uranos.testplugin"
|
||||||
version = "0.0.1-SNAPSHOT"
|
version = "0.0.1-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -11,7 +11,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":blokk-api"))
|
implementation(project(":uranos-api"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package space.blokk.testplugin
|
package space.uranos.testplugin
|
||||||
|
|
||||||
import space.blokk.Blokk
|
import space.uranos.Uranos
|
||||||
import space.blokk.chat.TextComponent
|
import space.uranos.chat.TextComponent
|
||||||
import space.blokk.net.ServerListInfo
|
import space.uranos.net.ServerListInfo
|
||||||
import space.blokk.net.event.ServerListInfoRequestEvent
|
import space.uranos.net.event.ServerListInfoRequestEvent
|
||||||
import space.blokk.net.event.SessionAfterLoginEvent
|
import space.uranos.net.event.SessionAfterLoginEvent
|
||||||
import space.blokk.player.GameMode
|
import space.uranos.player.GameMode
|
||||||
import space.blokk.plugin.Plugin
|
import space.uranos.plugin.Plugin
|
||||||
import space.blokk.testplugin.anvil.AnvilWorld
|
import space.uranos.testplugin.anvil.AnvilWorld
|
||||||
import space.blokk.world.Dimension
|
import space.uranos.world.Dimension
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
import space.blokk.world.WorldAndLocationWithRotation
|
import space.uranos.world.WorldAndLocationWithRotation
|
||||||
import space.blokk.world.block.CraftingTable
|
import space.uranos.world.block.CraftingTable
|
||||||
import space.blokk.world.block.GreenWool
|
import space.uranos.world.block.GreenWool
|
||||||
import space.blokk.world.block.RedWool
|
import space.uranos.world.block.RedWool
|
||||||
|
|
||||||
class TestPlugin: Plugin("Test", "1.0.0") {
|
class TestPlugin: Plugin("Test", "1.0.0") {
|
||||||
override fun onEnable() {
|
override fun onEnable() {
|
||||||
|
@ -24,7 +24,7 @@ class TestPlugin: Plugin("Test", "1.0.0") {
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
Blokk.dimensionRegistry.register(dimension)
|
Uranos.dimensionRegistry.register(dimension)
|
||||||
|
|
||||||
val world = AnvilWorld(dimension, true)
|
val world = AnvilWorld(dimension, true)
|
||||||
world.getVoxelsInCube(VoxelLocation.of(16, 0, 16), VoxelLocation.of(-16, 0, -16)).forEach {
|
world.getVoxelsInCube(VoxelLocation.of(16, 0, 16), VoxelLocation.of(-16, 0, -16)).forEach {
|
||||||
|
@ -33,11 +33,11 @@ class TestPlugin: Plugin("Test", "1.0.0") {
|
||||||
|
|
||||||
world.getVoxel(VoxelLocation.of(-1, 2, -1)).block = CraftingTable()
|
world.getVoxel(VoxelLocation.of(-1, 2, -1)).block = CraftingTable()
|
||||||
|
|
||||||
Blokk.eventBus.on<ServerListInfoRequestEvent> { event ->
|
Uranos.eventBus.on<ServerListInfoRequestEvent> { event ->
|
||||||
event.response = ServerListInfo("1.16.4", 754, TextComponent of "Test", 10, 0, emptyList())
|
event.response = ServerListInfo("1.16.4", 754, TextComponent of "Test", 10, 0, emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
Blokk.eventBus.on<SessionAfterLoginEvent> { event ->
|
Uranos.eventBus.on<SessionAfterLoginEvent> { event ->
|
||||||
event.gameMode = GameMode.CREATIVE
|
event.gameMode = GameMode.CREATIVE
|
||||||
event.canFly = true
|
event.canFly = true
|
||||||
event.flying = true
|
event.flying = true
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package space.blokk.testplugin.anvil
|
package space.uranos.testplugin.anvil
|
||||||
|
|
||||||
import com.google.common.cache.LoadingCache
|
import com.google.common.cache.LoadingCache
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
import space.blokk.util.createWeakValuesLoadingCache
|
import space.uranos.util.createWeakValuesLoadingCache
|
||||||
import space.blokk.world.*
|
import space.uranos.world.*
|
||||||
import space.blokk.world.block.Air
|
import space.uranos.world.block.Air
|
||||||
import space.blokk.world.block.Block
|
import space.uranos.world.block.Block
|
||||||
|
|
||||||
class AnvilChunk(world: AnvilWorld, key: Key) : Chunk(world, key) {
|
class AnvilChunk(world: AnvilWorld, key: Key) : Chunk(world, key) {
|
||||||
// TODO: Implement light
|
// TODO: Implement light
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package space.blokk.testplugin.anvil
|
package space.uranos.testplugin.anvil
|
||||||
|
|
||||||
import space.blokk.world.Chunk
|
import space.uranos.world.Chunk
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
import space.blokk.world.block.Air
|
import space.uranos.world.block.Air
|
||||||
import space.blokk.world.block.Block
|
import space.uranos.world.block.Block
|
||||||
|
|
||||||
class AnvilChunkSection {
|
class AnvilChunkSection {
|
||||||
val blocks: Array<Block> = Array(Chunk.BLOCKS_IN_A_SECTION) { Air }
|
val blocks: Array<Block> = Array(Chunk.BLOCKS_IN_A_SECTION) { Air }
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package space.blokk.testplugin.anvil
|
package space.uranos.testplugin.anvil
|
||||||
|
|
||||||
import space.blokk.world.Chunk
|
import space.uranos.world.Chunk
|
||||||
import space.blokk.world.Voxel
|
import space.uranos.world.Voxel
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
import space.blokk.world.block.Block
|
import space.uranos.world.block.Block
|
||||||
|
|
||||||
class AnvilVoxel(
|
class AnvilVoxel(
|
||||||
override val location: VoxelLocation,
|
override val location: VoxelLocation,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package space.blokk.testplugin.anvil
|
package space.uranos.testplugin.anvil
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder
|
import com.google.common.cache.CacheBuilder
|
||||||
import com.google.common.cache.CacheLoader
|
import com.google.common.cache.CacheLoader
|
||||||
import com.google.common.cache.LoadingCache
|
import com.google.common.cache.LoadingCache
|
||||||
import space.blokk.entity.Entity
|
import space.uranos.entity.Entity
|
||||||
import space.blokk.world.Chunk
|
import space.uranos.world.Chunk
|
||||||
import space.blokk.world.Dimension
|
import space.uranos.world.Dimension
|
||||||
import space.blokk.world.World
|
import space.uranos.world.World
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class AnvilWorld(
|
class AnvilWorld(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
space.blokk.testplugin.TestPlugin
|
space.uranos.testplugin.TestPlugin
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
enum class CardinalDirection(private val direction: Direction) {
|
enum class CardinalDirection(private val direction: Direction) {
|
||||||
NORTH(Direction.NORTH),
|
NORTH(Direction.NORTH),
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
enum class CoordinatePart {
|
enum class CoordinatePart {
|
||||||
X,
|
X,
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
enum class Difficulty {
|
enum class Difficulty {
|
||||||
PEACEFUL,
|
PEACEFUL,
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
enum class Direction {
|
enum class Direction {
|
||||||
NORTH,
|
NORTH,
|
|
@ -1,6 +1,6 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
import space.blokk.world.Dimension
|
import space.uranos.world.Dimension
|
||||||
|
|
||||||
object NamespacedID {
|
object NamespacedID {
|
||||||
val ID_REGEX = Regex("[0-9a-z._/-]")
|
val ID_REGEX = Regex("[0-9a-z._/-]")
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
import kotlinx.coroutines.NonCancellable
|
import kotlinx.coroutines.NonCancellable
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
7
uranos-api/src/main/kotlin/space/uranos/Uranos.kt
Normal file
7
uranos-api/src/main/kotlin/space/uranos/Uranos.kt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package space.uranos
|
||||||
|
|
||||||
|
import space.uranos.server.Server
|
||||||
|
|
||||||
|
private lateinit var serverInstance: Server
|
||||||
|
|
||||||
|
object Uranos : Server by serverInstance
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk
|
package space.uranos
|
||||||
|
|
||||||
import space.blokk.util.clamp
|
import space.uranos.util.clamp
|
||||||
import space.blokk.world.Location
|
import space.uranos.world.Location
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.chat
|
package space.uranos.chat
|
||||||
|
|
||||||
import com.squareup.moshi.FromJson
|
import com.squareup.moshi.FromJson
|
||||||
import com.squareup.moshi.ToJson
|
import com.squareup.moshi.ToJson
|
|
@ -1,7 +1,7 @@
|
||||||
package space.blokk.chat
|
package space.uranos.chat
|
||||||
|
|
||||||
import com.squareup.moshi.*
|
import com.squareup.moshi.*
|
||||||
import space.blokk.util.moshi
|
import space.uranos.util.moshi
|
||||||
|
|
||||||
sealed class ChatComponent {
|
sealed class ChatComponent {
|
||||||
abstract val bold: Boolean
|
abstract val bold: Boolean
|
|
@ -1,9 +1,9 @@
|
||||||
package space.blokk.chat
|
package space.uranos.chat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You should use [ChatComponent][space.blokk.chat.ChatComponent] whenever it's possible, but sometimes these codes
|
* You should use [ChatComponent][space.uranos.chat.ChatComponent] whenever it's possible, but sometimes these codes
|
||||||
* are required, for example in [the name of a player in a server list sample]
|
* are required, for example in [the name of a player in a server list sample]
|
||||||
* [space.blokk.net.packet.status.ResponsePacket.Players.SampleEntry.name].
|
* [space.uranos.net.packet.status.ResponsePacket.Players.SampleEntry.name].
|
||||||
*/
|
*/
|
||||||
enum class LegacyFormattingCode(private val char: Char) {
|
enum class LegacyFormattingCode(private val char: Char) {
|
||||||
BLACK('0'),
|
BLACK('0'),
|
|
@ -1,6 +1,6 @@
|
||||||
package space.blokk.command
|
package space.uranos.command
|
||||||
|
|
||||||
import space.blokk.RegistryItem
|
import space.uranos.RegistryItem
|
||||||
|
|
||||||
abstract class Command : RegistryItem {
|
abstract class Command : RegistryItem {
|
||||||
abstract override val id: String
|
abstract override val id: String
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk.entity
|
package space.uranos.entity
|
||||||
|
|
||||||
import space.blokk.event.Event
|
import space.uranos.event.Event
|
||||||
import space.blokk.event.EventBus
|
import space.uranos.event.EventBus
|
||||||
import space.blokk.logging.Logger
|
import space.uranos.logging.Logger
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package space.blokk.entity
|
package space.uranos.entity
|
||||||
|
|
||||||
import space.blokk.world.block.Block
|
import space.uranos.world.block.Block
|
||||||
import space.blokk.world.block.Material
|
import space.uranos.world.block.Material
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
interface EntityType<T : Entity> {
|
interface EntityType<T : Entity> {
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import kotlin.contracts.InvocationKind
|
import kotlin.contracts.InvocationKind
|
||||||
import kotlin.contracts.contract
|
import kotlin.contracts.contract
|
|
@ -1,7 +1,4 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import space.blokk.Blokk
|
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
abstract class Event
|
abstract class Event
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
import space.blokk.plugin.Plugin
|
import space.uranos.plugin.Plugin
|
||||||
import java.util.concurrent.ConcurrentSkipListSet
|
import java.util.concurrent.ConcurrentSkipListSet
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
|
@ -1,6 +1,6 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import space.blokk.Blokk
|
import space.uranos.Uranos
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
class EventBusWrapper<E>(private val target: Any): EventEmitter<TargetedEvent<E>>() {
|
class EventBusWrapper<E>(private val target: Any): EventEmitter<TargetedEvent<E>>() {
|
||||||
|
@ -8,5 +8,5 @@ class EventBusWrapper<E>(private val target: Any): EventEmitter<TargetedEvent<E>
|
||||||
eventType: KClass<T>,
|
eventType: KClass<T>,
|
||||||
handlerPosition: EventHandlerPosition,
|
handlerPosition: EventHandlerPosition,
|
||||||
fn: suspend (event: T) -> Unit
|
fn: suspend (event: T) -> Unit
|
||||||
): EventHandler<T> = Blokk.eventBus.on(eventType, handlerPosition) { event -> if (event.target == target) fn(event) }
|
): EventHandler<T> = Uranos.eventBus.on(eventType, handlerPosition) { event -> if (event.target == target) fn(event) }
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import space.blokk.plugin.Plugin
|
import space.uranos.plugin.Plugin
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
import space.blokk.Blokk
|
import space.uranos.Uranos
|
||||||
|
|
||||||
open class EventHandlerPosition: Comparable<EventHandlerPosition> {
|
open class EventHandlerPosition: Comparable<EventHandlerPosition> {
|
||||||
override fun compareTo(other: EventHandlerPosition): Int =
|
override fun compareTo(other: EventHandlerPosition): Int =
|
||||||
Blokk.eventHandlerPositions.positionOf(this) - Blokk.eventHandlerPositions.positionOf(other)
|
Uranos.eventHandlerPositions.positionOf(this) - Uranos.eventHandlerPositions.positionOf(other)
|
||||||
|
|
||||||
object FIRST: EventHandlerPosition()
|
object FIRST: EventHandlerPosition()
|
||||||
object NORMAL: EventHandlerPosition()
|
object NORMAL: EventHandlerPosition()
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.event
|
package space.uranos.event
|
||||||
|
|
||||||
interface EventHandlerPositionManager {
|
interface EventHandlerPositionManager {
|
||||||
fun positionOf(eventHandlerPosition: EventHandlerPosition): Int
|
fun positionOf(eventHandlerPosition: EventHandlerPosition): Int
|
|
@ -1,10 +1,10 @@
|
||||||
package space.blokk.logging
|
package space.uranos.logging
|
||||||
|
|
||||||
import space.blokk.Blokk
|
import space.uranos.Uranos
|
||||||
|
|
||||||
class Logger(val name: String, private val printThreadName: Boolean = true) {
|
class Logger(val name: String, private val printThreadName: Boolean = true) {
|
||||||
private fun log(level: Level, message: String, throwable: Throwable? = null) =
|
private fun log(level: Level, message: String, throwable: Throwable? = null) =
|
||||||
Blokk.loggingOutputProvider.log(printThreadName, name, level, message, throwable)
|
Uranos.loggingOutputProvider.log(printThreadName, name, level, message, throwable)
|
||||||
|
|
||||||
fun error(message: String, throwable: Throwable) = log(Level.ERROR, message, throwable)
|
fun error(message: String, throwable: Throwable) = log(Level.ERROR, message, throwable)
|
||||||
|
|
||||||
|
@ -43,6 +43,6 @@ class Logger(val name: String, private val printThreadName: Boolean = true) {
|
||||||
|
|
||||||
fun isGreaterOrEqualThan(level: Level) = ordinal >= level.ordinal
|
fun isGreaterOrEqualThan(level: Level) = ordinal >= level.ordinal
|
||||||
|
|
||||||
val isEnabled get() = isGreaterOrEqualThan(Blokk.minimumLogLevel)
|
val isEnabled get() = isGreaterOrEqualThan(Uranos.minimumLogLevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.logging
|
package space.uranos.logging
|
||||||
|
|
||||||
interface LoggingOutputProvider {
|
interface LoggingOutputProvider {
|
||||||
fun log(
|
fun log(
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.net
|
package space.uranos.net
|
||||||
|
|
||||||
import java.util.concurrent.CancellationException
|
import java.util.concurrent.CancellationException
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
package space.blokk.net
|
package space.uranos.net
|
||||||
|
|
||||||
class PacketDecodingException : Exception("Packet decoding failed")
|
class PacketDecodingException : Exception("Packet decoding failed")
|
|
@ -1,17 +1,17 @@
|
||||||
package space.blokk.net
|
package space.uranos.net
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import space.blokk.chat.TextComponent
|
import space.uranos.chat.TextComponent
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used in the [ServerListInfoRequestEvent][space.blokk.net.event.ServerListInfoRequestEvent].
|
* Used in the [ServerListInfoRequestEvent][space.uranos.net.event.ServerListInfoRequestEvent].
|
||||||
*
|
*
|
||||||
* @param versionName The name of the Minecraft version the server uses.
|
* @param versionName The name of the Minecraft version the server uses.
|
||||||
* @param protocolVersion The number of the [protocol version](https://wiki.vg/Protocol_version_numbers) used by the server.
|
* @param protocolVersion The number of the [protocol version](https://wiki.vg/Protocol_version_numbers) used by the server.
|
||||||
* @param description The description of the server. Although this is a [TextComponent],
|
* @param description The description of the server. Although this is a [TextComponent],
|
||||||
* [LegacyFormattingCode][space.blokk.chat.LegacyFormattingCode]s must be used.
|
* [LegacyFormattingCode][space.uranos.chat.LegacyFormattingCode]s must be used.
|
||||||
* @param maxPlayers The maximum amount of players that can join the server. This is only visual.
|
* @param maxPlayers The maximum amount of players that can join the server. This is only visual.
|
||||||
* @param onlinePlayers The amount of online players.
|
* @param onlinePlayers The amount of online players.
|
||||||
* @param playerListSample The players shown when hovering over the player count.
|
* @param playerListSample The players shown when hovering over the player count.
|
|
@ -1,13 +1,13 @@
|
||||||
package space.blokk.net
|
package space.uranos.net
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import space.blokk.chat.TextComponent
|
import space.uranos.chat.TextComponent
|
||||||
import space.blokk.event.EventBusWrapper
|
import space.uranos.event.EventBusWrapper
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
import space.uranos.net.packet.OutgoingPacket
|
||||||
import space.blokk.net.packet.Protocol
|
import space.uranos.net.packet.Protocol
|
||||||
import space.blokk.player.GameMode
|
import space.uranos.player.GameMode
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
import space.blokk.world.WorldAndLocationWithRotation
|
import space.uranos.world.WorldAndLocationWithRotation
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
@ -28,7 +28,7 @@ abstract class Session {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The brand name the client optionally sent during the login procedure.
|
* The brand name the client optionally sent during the login procedure.
|
||||||
* [ClientBrandReceivedEvent][space.blokk.net.event.ClientBrandReceivedEvent] is emitted when this value changes.
|
* [ClientBrandReceivedEvent][space.uranos.net.event.ClientBrandReceivedEvent] is emitted when this value changes.
|
||||||
*/
|
*/
|
||||||
abstract val brand: String?
|
abstract val brand: String?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when the client sends his brand during the login process.
|
* Emitted when the client sends his brand during the login process.
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.net.packet.IncomingPacket
|
import space.uranos.net.packet.IncomingPacket
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when a packet is received.
|
* Emitted when a packet is received.
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.net.packet.OutgoingPacket
|
import space.uranos.net.packet.OutgoingPacket
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when a packet is going to be sent.
|
* Emitted when a packet is going to be sent.
|
|
@ -1,9 +1,9 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when a [Player] instance will be initialized.
|
* Emitted when a [Player] instance will be initialized.
|
|
@ -1,8 +1,8 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.ServerListInfo
|
import space.uranos.net.ServerListInfo
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when a client requests general info about the server, usually to show it in the server list.
|
* Emitted when a client requests general info about the server, usually to show it in the server list.
|
|
@ -1,10 +1,10 @@
|
||||||
package space.blokk.net.event
|
package space.uranos.net.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.player.GameMode
|
import space.uranos.player.GameMode
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
import space.blokk.world.WorldAndLocationWithRotation
|
import space.uranos.world.WorldAndLocationWithRotation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted after a [Session] finished logging in.
|
* Emitted after a [Session] finished logging in.
|
|
@ -0,0 +1,7 @@
|
||||||
|
package space.uranos.net.event
|
||||||
|
|
||||||
|
import space.uranos.event.Event
|
||||||
|
import space.uranos.event.TargetedEvent
|
||||||
|
import space.uranos.net.Session
|
||||||
|
|
||||||
|
abstract class SessionEvent : TargetedEvent<Session>()
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.net.packet
|
package space.uranos.net.packet
|
||||||
|
|
||||||
sealed class Packet {
|
sealed class Packet {
|
||||||
override fun toString(): String = this::class.java.simpleName + "(no data)"
|
override fun toString(): String = this::class.java.simpleName + "(no data)"
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.net.packet
|
package space.uranos.net.packet
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder
|
import com.google.common.cache.CacheBuilder
|
||||||
import com.google.common.cache.CacheLoader
|
import com.google.common.cache.CacheLoader
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.net.packet
|
package space.uranos.net.packet
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.player
|
package space.uranos.player
|
||||||
|
|
||||||
enum class ChatMode {
|
enum class ChatMode {
|
||||||
ENABLED,
|
ENABLED,
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.player
|
package space.uranos.player
|
||||||
|
|
||||||
enum class GameMode(val numericID: Int) {
|
enum class GameMode(val numericID: Int) {
|
||||||
SURVIVAL(0),
|
SURVIVAL(0),
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.player
|
package space.uranos.player
|
||||||
|
|
||||||
enum class Hand {
|
enum class Hand {
|
||||||
LEFT,
|
LEFT,
|
|
@ -1,13 +1,13 @@
|
||||||
package space.blokk.player
|
package space.uranos.player
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import space.blokk.chat.TextComponent
|
import space.uranos.chat.TextComponent
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.player.event.PlayerEvent
|
import space.uranos.player.event.PlayerEvent
|
||||||
import space.blokk.world.Chunk
|
import space.uranos.world.Chunk
|
||||||
import space.blokk.world.LocationWithRotation
|
import space.uranos.world.LocationWithRotation
|
||||||
import space.blokk.world.VoxelLocation
|
import space.uranos.world.VoxelLocation
|
||||||
import space.blokk.world.World
|
import space.uranos.world.World
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.player
|
package space.uranos.player
|
||||||
|
|
||||||
data class SkinPartsConfiguration(
|
data class SkinPartsConfiguration(
|
||||||
val cape: Boolean,
|
val cape: Boolean,
|
|
@ -0,0 +1,6 @@
|
||||||
|
package space.uranos.player.event
|
||||||
|
|
||||||
|
import space.uranos.event.Event
|
||||||
|
import space.uranos.player.Player
|
||||||
|
|
||||||
|
abstract class PlayerEvent(val player: Player) : Event()
|
|
@ -1,5 +1,5 @@
|
||||||
package space.blokk.player.event
|
package space.uranos.player.event
|
||||||
|
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
|
|
||||||
class PlayerSettingsUpdateEvent(player: Player, val settings: Player.Settings) : PlayerEvent(player)
|
class PlayerSettingsUpdateEvent(player: Player, val settings: Player.Settings) : PlayerEvent(player)
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.plugin
|
package space.uranos.plugin
|
||||||
|
|
||||||
abstract class Plugin(name: String, version: String) {
|
abstract class Plugin(name: String, version: String) {
|
||||||
val meta = Meta(name, version)
|
val meta = Meta(name, version)
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.plugin
|
package space.uranos.plugin
|
||||||
|
|
||||||
interface PluginManager {
|
interface PluginManager {
|
||||||
val plugins: List<Plugin>
|
val plugins: List<Plugin>
|
|
@ -1,6 +1,6 @@
|
||||||
package space.blokk.recipe
|
package space.uranos.recipe
|
||||||
|
|
||||||
import space.blokk.RegistryItem
|
import space.uranos.RegistryItem
|
||||||
|
|
||||||
sealed class Recipe: RegistryItem {
|
sealed class Recipe: RegistryItem {
|
||||||
abstract val group: String
|
abstract val group: String
|
|
@ -1,18 +1,18 @@
|
||||||
package space.blokk.server
|
package space.uranos.server
|
||||||
|
|
||||||
import space.blokk.Registry
|
import space.uranos.Registry
|
||||||
import space.blokk.Scheduler
|
import space.uranos.Scheduler
|
||||||
import space.blokk.command.Command
|
import space.uranos.command.Command
|
||||||
import space.blokk.event.EventBus
|
import space.uranos.event.EventBus
|
||||||
import space.blokk.event.EventHandlerPositionManager
|
import space.uranos.event.EventHandlerPositionManager
|
||||||
import space.blokk.logging.Logger
|
import space.uranos.logging.Logger
|
||||||
import space.blokk.logging.LoggingOutputProvider
|
import space.uranos.logging.LoggingOutputProvider
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
import space.blokk.player.Player
|
import space.uranos.player.Player
|
||||||
import space.blokk.plugin.PluginManager
|
import space.uranos.plugin.PluginManager
|
||||||
import space.blokk.recipe.Recipe
|
import space.uranos.recipe.Recipe
|
||||||
import space.blokk.world.BiomeRegistry
|
import space.uranos.world.BiomeRegistry
|
||||||
import space.blokk.world.Dimension
|
import space.uranos.world.Dimension
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ interface Server {
|
||||||
|
|
||||||
val pluginManager: PluginManager
|
val pluginManager: PluginManager
|
||||||
val serverDirectory: File
|
val serverDirectory: File
|
||||||
|
val cacheDirectory: File get() = serverDirectory.resolve("cache")
|
||||||
|
|
||||||
val dimensionRegistry: Registry<Dimension>
|
val dimensionRegistry: Registry<Dimension>
|
||||||
val recipeRegistry: Registry<Recipe>
|
val recipeRegistry: Registry<Recipe>
|
|
@ -0,0 +1,5 @@
|
||||||
|
package space.uranos.server.event
|
||||||
|
|
||||||
|
import space.uranos.event.Event
|
||||||
|
|
||||||
|
abstract class ServerEvent : Event()
|
|
@ -1,7 +1,7 @@
|
||||||
package space.blokk.server.event
|
package space.uranos.server.event
|
||||||
|
|
||||||
import space.blokk.event.Cancellable
|
import space.uranos.event.Cancellable
|
||||||
import space.blokk.net.Session
|
import space.uranos.net.Session
|
||||||
|
|
||||||
class SessionInitializedEvent(val session: Session) : ServerEvent(), Cancellable {
|
class SessionInitializedEvent(val session: Session) : ServerEvent(), Cancellable {
|
||||||
override var cancelled: Boolean = false
|
override var cancelled: Boolean = false
|
|
@ -1,9 +1,9 @@
|
||||||
package space.blokk.tag
|
package space.uranos.tag
|
||||||
|
|
||||||
import space.blokk.entity.EntityType
|
import space.uranos.entity.EntityType
|
||||||
import space.blokk.item.ItemType
|
import space.uranos.item.ItemType
|
||||||
import space.blokk.world.NUMERIC_FLUID_IDS_BY_ID
|
import space.uranos.world.NUMERIC_FLUID_IDS_BY_ID
|
||||||
import space.blokk.world.block.Material
|
import space.uranos.world.block.Material
|
||||||
|
|
||||||
// TODO: Allow plugins to create custom tags and actually use tag values server-side
|
// TODO: Allow plugins to create custom tags and actually use tag values server-side
|
||||||
class Tag(val name: String, val type: Type, val rawValues: List<String>) {
|
class Tag(val name: String, val type: Type, val rawValues: List<String>) {
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.tag
|
package space.uranos.tag
|
||||||
|
|
||||||
object TagRegistry {
|
object TagRegistry {
|
||||||
val tags: List<Tag> = MINECRAFT_INTERNAL_TAGS.toList()
|
val tags: List<Tag> = MINECRAFT_INTERNAL_TAGS.toList()
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import kotlin.experimental.and
|
import kotlin.experimental.and
|
||||||
import kotlin.experimental.inv
|
import kotlin.experimental.inv
|
|
@ -1,3 +1,3 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
fun Int.clamp(range: IntRange) = maxOf(minOf(range.first, range.last), minOf(maxOf(range.first, range.last), this))
|
fun Int.clamp(range: IntRange) = maxOf(minOf(range.first, range.last), minOf(maxOf(range.first, range.last), this))
|
|
@ -1,10 +1,8 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineName
|
import kotlinx.coroutines.CoroutineName
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.job
|
import kotlinx.coroutines.job
|
||||||
import space.blokk.Blokk
|
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
fun CoroutineContext.supervisorChild(name: String) = this + CoroutineName(name) + SupervisorJob(this.job)
|
fun CoroutineContext.supervisorChild(name: String) = this + CoroutineName(name) + SupervisorJob(this.job)
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder
|
import com.google.common.cache.CacheBuilder
|
||||||
import com.google.common.cache.CacheLoader
|
import com.google.common.cache.CacheLoader
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import com.squareup.moshi.FromJson
|
import com.squareup.moshi.FromJson
|
||||||
import com.squareup.moshi.JsonQualifier
|
import com.squareup.moshi.JsonQualifier
|
||||||
import com.squareup.moshi.Moshi
|
import com.squareup.moshi.Moshi
|
||||||
import com.squareup.moshi.ToJson
|
import com.squareup.moshi.ToJson
|
||||||
import space.blokk.chat.ChatColor
|
import space.uranos.chat.ChatColor
|
||||||
import space.blokk.chat.ChatComponent
|
import space.uranos.chat.ChatComponent
|
||||||
import space.blokk.chat.TextComponent
|
import space.uranos.chat.TextComponent
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
fun Moshi.toJson(value: Map<*, *>): String = adapter(Map::class.java).toJson(value)
|
fun Moshi.toJson(value: Map<*, *>): String = adapter(Map::class.java).toJson(value)
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
||||||
import kotlinx.coroutines.asCoroutineDispatcher
|
import kotlinx.coroutines.asCoroutineDispatcher
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If [count] is 1, it returns [singular], else [plural].
|
* If [count] is 1, it returns [singular], else [plural].
|
|
@ -1,15 +1,15 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import space.blokk.Blokk
|
import space.uranos.Uranos
|
||||||
import space.blokk.server.Server
|
import space.uranos.server.Server
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspends for [ticks].
|
* Suspends for [ticks].
|
||||||
*/
|
*/
|
||||||
suspend inline fun delayTicks(ticks: Int) {
|
suspend inline fun delayTicks(ticks: Int) {
|
||||||
Blokk.scheduler.runAfter(ticks) {}
|
Uranos.scheduler.runAfter(ticks) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ inline fun CoroutineScope.launchNextTick(crossinline block: suspend () -> Unit)
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun nextTick(noinline block: suspend () -> Unit) {
|
inline fun nextTick(noinline block: suspend () -> Unit) {
|
||||||
Blokk.scheduler.executeAfter(1, block)
|
Uranos.scheduler.executeAfter(1, block)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package space.blokk.util
|
package space.uranos.util
|
||||||
|
|
||||||
infix fun Int.untilPossiblyNegative(other: Int) =
|
infix fun Int.untilPossiblyNegative(other: Int) =
|
||||||
IntProgression.fromClosedRange(this, other, if (this > other) -1 else 1)
|
IntProgression.fromClosedRange(this, other, if (this > other) -1 else 1)
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue