Archived
1
0
Fork 0

Rename project to Uranos

This commit is contained in:
Moritz Ruth 2021-01-02 23:20:33 +01:00
parent 32103d695a
commit d46675dff3
237 changed files with 798 additions and 822 deletions

View file

@ -1,12 +1,12 @@
<component name="ProjectRunConfigurationManager">
<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="PROGRAM_PARAMETERS" value="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<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="" />
<method v="2">
<option name="Make" enabled="true" />

View file

@ -1,6 +1,6 @@
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
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,4 +1,4 @@
# Blokk
# Uranos
## Conventions

View file

@ -1,7 +0,0 @@
package space.blokk
import space.blokk.server.Server
private lateinit var serverInstance: Server
object Blokk : Server by serverInstance

View file

@ -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>()

View file

@ -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()

View file

@ -1,5 +0,0 @@
package space.blokk.server.event
import space.blokk.event.Event
abstract class ServerEvent : Event()

View file

@ -1,5 +0,0 @@
package space.blokk.net.packet.handshaking
import space.blokk.net.packet.Protocol
object HandshakingProtocol : Protocol("HANDSHAKING", HandshakePacketCodec)

View file

@ -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()

View file

@ -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()

View file

@ -1,5 +0,0 @@
package space.blokk.net.packet.play
import space.blokk.net.packet.IncomingPacket
data class IncomingKeepAlivePacket(val id: Long) : IncomingPacket()

View file

@ -1,5 +0,0 @@
package space.blokk.net.packet.play
import space.blokk.net.packet.OutgoingPacket
data class OutgoingKeepAlivePacket(val id: Long) : OutgoingPacket()

View file

@ -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()

View file

@ -6,7 +6,7 @@ plugins {
id("minecraft-data-sources")
}
group = "space.blokk"
group = "space.uranos"
version = "0.0.1-SNAPSHOT"
repositories {

View file

@ -29,7 +29,7 @@ gradlePlugin {
plugins {
create("minecraft-data-sources") {
id = "minecraft-data-sources"
implementationClass = "space.blokk.mdsp.MinecraftDataSourcesPlugin"
implementationClass = "space.uranos.mdsp.MinecraftDataSourcesPlugin"
}
}
}

View file

@ -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/"

View file

@ -1,4 +1,4 @@
package space.blokk.mdsp
package space.uranos.mdsp
import okhttp3.OkHttpClient
import okhttp3.Request

View file

@ -1,4 +1,4 @@
package space.blokk.mdsp
package space.uranos.mdsp
import java.io.File

View file

@ -1,20 +1,20 @@
package space.blokk.mdsp
package space.uranos.mdsp
import com.jsoniter.JsonIterator
import org.gradle.api.Plugin
import org.gradle.api.Project
import space.blokk.mdsp.generator.*
import space.uranos.mdsp.generator.*
class MinecraftDataSourcesPlugin : Plugin<Project> {
override fun apply(project: Project) {
val workingDir = project.file("buildSrcTemp")
val outputDir = project
.project(":blokk-api")
.project(":uranos-api")
.projectDir
.resolve("src/main/generatedKotlin")
val sourcesDir = project
.project(":blokk-api")
.project(":uranos-api")
.projectDir
.resolve("src/main/kotlin")

View file

@ -1,10 +1,10 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
import com.google.common.base.CaseFormat
import com.jsoniter.JsonIterator
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import space.blokk.mdsp.JsonAny
import space.uranos.mdsp.JsonAny
import java.io.File
class BlocksAndMaterialGenerator(

View file

@ -1,8 +1,8 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
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 BLOCK_PACKAGE = "$WORLD_PACKAGE.block"
const val ENTITY_PACKAGE = "$BASE_PACKAGE.entity"

View file

@ -1,10 +1,10 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
import com.google.common.base.CaseFormat
import com.jsoniter.JsonIterator
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import space.blokk.mdsp.JsonAny
import space.uranos.mdsp.JsonAny
import java.io.File
class EntitiesGenerator(

View file

@ -1,11 +1,11 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
import com.google.common.base.CaseFormat
import com.jsoniter.JsonIterator
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import java.io.File
import space.blokk.mdsp.JsonAny
import space.uranos.mdsp.JsonAny
class FluidIDMapGenerator(
private val workingDir: File,

View file

@ -1,11 +1,11 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
import com.google.common.base.CaseFormat
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import java.io.File
import space.blokk.mdsp.util.ConstructorPropertiesHelper
import space.blokk.mdsp.JsonAny
import space.uranos.mdsp.util.ConstructorPropertiesHelper
import space.uranos.mdsp.JsonAny
class ItemTypeEnumGenerator(
private val workingDir: File,

View file

@ -1,4 +1,4 @@
package space.blokk.mdsp.generator
package space.uranos.mdsp.generator
import com.jsoniter.JsonIterator
import com.squareup.kotlinpoet.*

View file

@ -1,4 +1,4 @@
package space.blokk.mdsp.util
package space.uranos.mdsp.util
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.PropertySpec

View file

@ -5,11 +5,11 @@ pluginManagement {
}
}
rootProject.name = "blokk"
rootProject.name = "uranos"
include(":blokk-api")
include(":blokk-nbt")
include(":blokk-packet-codecs")
include(":blokk-packets")
include(":blokk-server")
include("test-plugin")
include(":uranos-api")
include(":uranos-nbt")
include(":uranos-packet-codecs")
include(":uranos-packets")
include(":uranos-server")
include(":test-plugin")

View file

@ -3,7 +3,7 @@ plugins {
id("com.github.johnrengelman.shadow") version "6.1.0"
}
group = "space.blokk.testplugin"
group = "space.uranos.testplugin"
version = "0.0.1-SNAPSHOT"
repositories {
@ -11,7 +11,7 @@ repositories {
}
dependencies {
implementation(project(":blokk-api"))
implementation(project(":uranos-api"))
}
tasks {

View file

@ -1,19 +1,19 @@
package space.blokk.testplugin
package space.uranos.testplugin
import space.blokk.Blokk
import space.blokk.chat.TextComponent
import space.blokk.net.ServerListInfo
import space.blokk.net.event.ServerListInfoRequestEvent
import space.blokk.net.event.SessionAfterLoginEvent
import space.blokk.player.GameMode
import space.blokk.plugin.Plugin
import space.blokk.testplugin.anvil.AnvilWorld
import space.blokk.world.Dimension
import space.blokk.world.VoxelLocation
import space.blokk.world.WorldAndLocationWithRotation
import space.blokk.world.block.CraftingTable
import space.blokk.world.block.GreenWool
import space.blokk.world.block.RedWool
import space.uranos.Uranos
import space.uranos.chat.TextComponent
import space.uranos.net.ServerListInfo
import space.uranos.net.event.ServerListInfoRequestEvent
import space.uranos.net.event.SessionAfterLoginEvent
import space.uranos.player.GameMode
import space.uranos.plugin.Plugin
import space.uranos.testplugin.anvil.AnvilWorld
import space.uranos.world.Dimension
import space.uranos.world.VoxelLocation
import space.uranos.world.WorldAndLocationWithRotation
import space.uranos.world.block.CraftingTable
import space.uranos.world.block.GreenWool
import space.uranos.world.block.RedWool
class TestPlugin: Plugin("Test", "1.0.0") {
override fun onEnable() {
@ -24,7 +24,7 @@ class TestPlugin: Plugin("Test", "1.0.0") {
true
)
Blokk.dimensionRegistry.register(dimension)
Uranos.dimensionRegistry.register(dimension)
val world = AnvilWorld(dimension, true)
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()
Blokk.eventBus.on<ServerListInfoRequestEvent> { event ->
Uranos.eventBus.on<ServerListInfoRequestEvent> { event ->
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.canFly = true
event.flying = true

View file

@ -1,11 +1,11 @@
package space.blokk.testplugin.anvil
package space.uranos.testplugin.anvil
import com.google.common.cache.LoadingCache
import space.blokk.player.Player
import space.blokk.util.createWeakValuesLoadingCache
import space.blokk.world.*
import space.blokk.world.block.Air
import space.blokk.world.block.Block
import space.uranos.player.Player
import space.uranos.util.createWeakValuesLoadingCache
import space.uranos.world.*
import space.uranos.world.block.Air
import space.uranos.world.block.Block
class AnvilChunk(world: AnvilWorld, key: Key) : Chunk(world, key) {
// TODO: Implement light

View file

@ -1,9 +1,9 @@
package space.blokk.testplugin.anvil
package space.uranos.testplugin.anvil
import space.blokk.world.Chunk
import space.blokk.world.VoxelLocation
import space.blokk.world.block.Air
import space.blokk.world.block.Block
import space.uranos.world.Chunk
import space.uranos.world.VoxelLocation
import space.uranos.world.block.Air
import space.uranos.world.block.Block
class AnvilChunkSection {
val blocks: Array<Block> = Array(Chunk.BLOCKS_IN_A_SECTION) { Air }

View file

@ -1,9 +1,9 @@
package space.blokk.testplugin.anvil
package space.uranos.testplugin.anvil
import space.blokk.world.Chunk
import space.blokk.world.Voxel
import space.blokk.world.VoxelLocation
import space.blokk.world.block.Block
import space.uranos.world.Chunk
import space.uranos.world.Voxel
import space.uranos.world.VoxelLocation
import space.uranos.world.block.Block
class AnvilVoxel(
override val location: VoxelLocation,

View file

@ -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.CacheLoader
import com.google.common.cache.LoadingCache
import space.blokk.entity.Entity
import space.blokk.world.Chunk
import space.blokk.world.Dimension
import space.blokk.world.World
import space.uranos.entity.Entity
import space.uranos.world.Chunk
import space.uranos.world.Dimension
import space.uranos.world.World
import java.util.*
class AnvilWorld(

View file

@ -1 +1 @@
space.blokk.testplugin.TestPlugin
space.uranos.testplugin.TestPlugin

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
enum class CardinalDirection(private val direction: Direction) {
NORTH(Direction.NORTH),

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
enum class CoordinatePart {
X,

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
enum class Difficulty {
PEACEFUL,

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
enum class Direction {
NORTH,

View file

@ -1,6 +1,6 @@
package space.blokk
package space.uranos
import space.blokk.world.Dimension
import space.uranos.world.Dimension
object NamespacedID {
val ID_REGEX = Regex("[0-9a-z._/-]")

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
import java.util.concurrent.ConcurrentHashMap

View file

@ -1,4 +1,4 @@
package space.blokk
package space.uranos
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.withContext

View file

@ -0,0 +1,7 @@
package space.uranos
import space.uranos.server.Server
private lateinit var serverInstance: Server
object Uranos : Server by serverInstance

View file

@ -1,8 +1,8 @@
package space.blokk
package space.uranos
import space.blokk.util.clamp
import space.blokk.world.Location
import space.blokk.world.VoxelLocation
import space.uranos.util.clamp
import space.uranos.world.Location
import space.uranos.world.VoxelLocation
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.roundToInt

View file

@ -1,4 +1,4 @@
package space.blokk.chat
package space.uranos.chat
import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson

View file

@ -1,7 +1,7 @@
package space.blokk.chat
package space.uranos.chat
import com.squareup.moshi.*
import space.blokk.util.moshi
import space.uranos.util.moshi
sealed class ChatComponent {
abstract val bold: Boolean

View file

@ -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]
* [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) {
BLACK('0'),

View file

@ -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 override val id: String

View file

@ -1,8 +1,8 @@
package space.blokk.entity
package space.uranos.entity
import space.blokk.event.Event
import space.blokk.event.EventBus
import space.blokk.logging.Logger
import space.uranos.event.Event
import space.uranos.event.EventBus
import space.uranos.logging.Logger
import java.util.*
import kotlin.reflect.KClass

View file

@ -1,7 +1,7 @@
package space.blokk.entity
package space.uranos.entity
import space.blokk.world.block.Block
import space.blokk.world.block.Material
import space.uranos.world.block.Block
import space.uranos.world.block.Material
import kotlin.reflect.KClass
interface EntityType<T : Entity> {

View file

@ -1,4 +1,4 @@
package space.blokk.event
package space.uranos.event
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View file

@ -1,7 +1,4 @@
package space.blokk.event
import space.blokk.Blokk
import kotlin.reflect.KClass
package space.uranos.event
abstract class Event

View file

@ -1,7 +1,7 @@
package space.blokk.event
package space.uranos.event
import kotlinx.coroutines.suspendCancellableCoroutine
import space.blokk.plugin.Plugin
import space.uranos.plugin.Plugin
import java.util.concurrent.ConcurrentSkipListSet
import kotlin.coroutines.resume
import kotlin.reflect.KClass

View file

@ -1,6 +1,6 @@
package space.blokk.event
package space.uranos.event
import space.blokk.Blokk
import space.uranos.Uranos
import kotlin.reflect.KClass
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>,
handlerPosition: EventHandlerPosition,
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) }
}

View file

@ -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 kotlin.reflect.KClass

View file

@ -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> {
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 NORMAL: EventHandlerPosition()

View file

@ -1,4 +1,4 @@
package space.blokk.event
package space.uranos.event
interface EventHandlerPositionManager {
fun positionOf(eventHandlerPosition: EventHandlerPosition): Int

View file

@ -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) {
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)
@ -43,6 +43,6 @@ class Logger(val name: String, private val printThreadName: Boolean = true) {
fun isGreaterOrEqualThan(level: Level) = ordinal >= level.ordinal
val isEnabled get() = isGreaterOrEqualThan(Blokk.minimumLogLevel)
val isEnabled get() = isGreaterOrEqualThan(Uranos.minimumLogLevel)
}
}

View file

@ -1,4 +1,4 @@
package space.blokk.logging
package space.uranos.logging
interface LoggingOutputProvider {
fun log(

View file

@ -1,4 +1,4 @@
package space.blokk.net
package space.uranos.net
import java.util.concurrent.CancellationException

View file

@ -1,3 +1,3 @@
package space.blokk.net
package space.uranos.net
class PacketDecodingException : Exception("Packet decoding failed")

View file

@ -1,17 +1,17 @@
package space.blokk.net
package space.uranos.net
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import space.blokk.chat.TextComponent
import space.uranos.chat.TextComponent
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 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],
* [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 onlinePlayers The amount of online players.
* @param playerListSample The players shown when hovering over the player count.

View file

@ -1,13 +1,13 @@
package space.blokk.net
package space.uranos.net
import io.netty.buffer.ByteBuf
import space.blokk.chat.TextComponent
import space.blokk.event.EventBusWrapper
import space.blokk.net.packet.OutgoingPacket
import space.blokk.net.packet.Protocol
import space.blokk.player.GameMode
import space.blokk.player.Player
import space.blokk.world.WorldAndLocationWithRotation
import space.uranos.chat.TextComponent
import space.uranos.event.EventBusWrapper
import space.uranos.net.packet.OutgoingPacket
import space.uranos.net.packet.Protocol
import space.uranos.player.GameMode
import space.uranos.player.Player
import space.uranos.world.WorldAndLocationWithRotation
import java.net.InetAddress
import java.util.*
import kotlin.coroutines.CoroutineContext
@ -28,7 +28,7 @@ abstract class Session {
/**
* 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?

View file

@ -1,7 +1,7 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.uranos.event.Cancellable
import space.uranos.net.Session
/**
* Emitted when the client sends his brand during the login process.

View file

@ -1,8 +1,8 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.blokk.net.packet.IncomingPacket
import space.uranos.event.Cancellable
import space.uranos.net.Session
import space.uranos.net.packet.IncomingPacket
/**
* Emitted when a packet is received.

View file

@ -1,8 +1,8 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.blokk.net.packet.OutgoingPacket
import space.uranos.event.Cancellable
import space.uranos.net.Session
import space.uranos.net.packet.OutgoingPacket
/**
* Emitted when a packet is going to be sent.

View file

@ -1,9 +1,9 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.blokk.player.Player
import space.blokk.world.VoxelLocation
import space.uranos.event.Cancellable
import space.uranos.net.Session
import space.uranos.player.Player
import space.uranos.world.VoxelLocation
/**
* Emitted when a [Player] instance will be initialized.

View file

@ -1,8 +1,8 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.ServerListInfo
import space.blokk.net.Session
import space.uranos.event.Cancellable
import space.uranos.net.ServerListInfo
import space.uranos.net.Session
/**
* Emitted when a client requests general info about the server, usually to show it in the server list.

View file

@ -1,10 +1,10 @@
package space.blokk.net.event
package space.uranos.net.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.blokk.player.GameMode
import space.blokk.player.Player
import space.blokk.world.WorldAndLocationWithRotation
import space.uranos.event.Cancellable
import space.uranos.net.Session
import space.uranos.player.GameMode
import space.uranos.player.Player
import space.uranos.world.WorldAndLocationWithRotation
/**
* Emitted after a [Session] finished logging in.

View file

@ -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>()

View file

@ -1,4 +1,4 @@
package space.blokk.net.packet
package space.uranos.net.packet
sealed class Packet {
override fun toString(): String = this::class.java.simpleName + "(no data)"

View file

@ -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.CacheLoader

View file

@ -1,4 +1,4 @@
package space.blokk.net.packet
package space.uranos.net.packet
import kotlin.reflect.KClass

View file

@ -1,4 +1,4 @@
package space.blokk.player
package space.uranos.player
enum class ChatMode {
ENABLED,

View file

@ -1,4 +1,4 @@
package space.blokk.player
package space.uranos.player
enum class GameMode(val numericID: Int) {
SURVIVAL(0),

View file

@ -1,4 +1,4 @@
package space.blokk.player
package space.uranos.player
enum class Hand {
LEFT,

View file

@ -1,13 +1,13 @@
package space.blokk.player
package space.uranos.player
import kotlinx.coroutines.CoroutineScope
import space.blokk.chat.TextComponent
import space.blokk.net.Session
import space.blokk.player.event.PlayerEvent
import space.blokk.world.Chunk
import space.blokk.world.LocationWithRotation
import space.blokk.world.VoxelLocation
import space.blokk.world.World
import space.uranos.chat.TextComponent
import space.uranos.net.Session
import space.uranos.player.event.PlayerEvent
import space.uranos.world.Chunk
import space.uranos.world.LocationWithRotation
import space.uranos.world.VoxelLocation
import space.uranos.world.World
import java.util.*
import kotlin.coroutines.CoroutineContext

View file

@ -1,4 +1,4 @@
package space.blokk.player
package space.uranos.player
data class SkinPartsConfiguration(
val cape: Boolean,

View file

@ -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()

View file

@ -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)

View file

@ -1,4 +1,4 @@
package space.blokk.plugin
package space.uranos.plugin
abstract class Plugin(name: String, version: String) {
val meta = Meta(name, version)

View file

@ -1,4 +1,4 @@
package space.blokk.plugin
package space.uranos.plugin
interface PluginManager {
val plugins: List<Plugin>

View file

@ -1,6 +1,6 @@
package space.blokk.recipe
package space.uranos.recipe
import space.blokk.RegistryItem
import space.uranos.RegistryItem
sealed class Recipe: RegistryItem {
abstract val group: String

View file

@ -1,18 +1,18 @@
package space.blokk.server
package space.uranos.server
import space.blokk.Registry
import space.blokk.Scheduler
import space.blokk.command.Command
import space.blokk.event.EventBus
import space.blokk.event.EventHandlerPositionManager
import space.blokk.logging.Logger
import space.blokk.logging.LoggingOutputProvider
import space.blokk.net.Session
import space.blokk.player.Player
import space.blokk.plugin.PluginManager
import space.blokk.recipe.Recipe
import space.blokk.world.BiomeRegistry
import space.blokk.world.Dimension
import space.uranos.Registry
import space.uranos.Scheduler
import space.uranos.command.Command
import space.uranos.event.EventBus
import space.uranos.event.EventHandlerPositionManager
import space.uranos.logging.Logger
import space.uranos.logging.LoggingOutputProvider
import space.uranos.net.Session
import space.uranos.player.Player
import space.uranos.plugin.PluginManager
import space.uranos.recipe.Recipe
import space.uranos.world.BiomeRegistry
import space.uranos.world.Dimension
import java.io.File
import kotlin.coroutines.CoroutineContext
@ -39,6 +39,7 @@ interface Server {
val pluginManager: PluginManager
val serverDirectory: File
val cacheDirectory: File get() = serverDirectory.resolve("cache")
val dimensionRegistry: Registry<Dimension>
val recipeRegistry: Registry<Recipe>

View file

@ -0,0 +1,5 @@
package space.uranos.server.event
import space.uranos.event.Event
abstract class ServerEvent : Event()

View file

@ -1,7 +1,7 @@
package space.blokk.server.event
package space.uranos.server.event
import space.blokk.event.Cancellable
import space.blokk.net.Session
import space.uranos.event.Cancellable
import space.uranos.net.Session
class SessionInitializedEvent(val session: Session) : ServerEvent(), Cancellable {
override var cancelled: Boolean = false

View file

@ -1,9 +1,9 @@
package space.blokk.tag
package space.uranos.tag
import space.blokk.entity.EntityType
import space.blokk.item.ItemType
import space.blokk.world.NUMERIC_FLUID_IDS_BY_ID
import space.blokk.world.block.Material
import space.uranos.entity.EntityType
import space.uranos.item.ItemType
import space.uranos.world.NUMERIC_FLUID_IDS_BY_ID
import space.uranos.world.block.Material
// 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>) {

View file

@ -1,4 +1,4 @@
package space.blokk.tag
package space.uranos.tag
object TagRegistry {
val tags: List<Tag> = MINECRAFT_INTERNAL_TAGS.toList()

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import kotlin.experimental.and
import kotlin.experimental.inv

View file

@ -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))

View file

@ -1,10 +1,8 @@
package space.blokk.util
package space.uranos.util
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.job
import space.blokk.Blokk
import kotlin.coroutines.CoroutineContext
fun CoroutineContext.supervisorChild(name: String) = this + CoroutineName(name) + SupervisorJob(this.job)

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import kotlin.reflect.KClass

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import kotlin.reflect.KProperty

View file

@ -1,12 +1,12 @@
package space.blokk.util
package space.uranos.util
import com.squareup.moshi.FromJson
import com.squareup.moshi.JsonQualifier
import com.squareup.moshi.Moshi
import com.squareup.moshi.ToJson
import space.blokk.chat.ChatColor
import space.blokk.chat.ChatComponent
import space.blokk.chat.TextComponent
import space.uranos.chat.ChatColor
import space.uranos.chat.ChatComponent
import space.uranos.chat.TextComponent
import java.util.*
fun Moshi.toJson(value: Map<*, *>): String = adapter(Map::class.java).toJson(value)

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import com.google.common.util.concurrent.ThreadFactoryBuilder
import kotlinx.coroutines.asCoroutineDispatcher

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
/**
* If [count] is 1, it returns [singular], else [plural].

View file

@ -1,15 +1,15 @@
package space.blokk.util
package space.uranos.util
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import space.blokk.Blokk
import space.blokk.server.Server
import space.uranos.Uranos
import space.uranos.server.Server
/**
* Suspends for [ticks].
*/
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")
inline fun nextTick(noinline block: suspend () -> Unit) {
Blokk.scheduler.executeAfter(1, block)
Uranos.scheduler.executeAfter(1, block)
}
/**

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
import java.util.*

View file

@ -1,4 +1,4 @@
package space.blokk.util
package space.uranos.util
infix fun Int.untilPossiblyNegative(other: Int) =
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