Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit c5f686c

Browse files
authored
Merge pull request #205 from DockyardMC/feature/noxesium
Add noxesium integration
2 parents 869fd42 + 11ad952 commit c5f686c

File tree

61 files changed

+1323
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1323
-42
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ repositories {
3030
maven("https://jitpack.io")
3131
maven("https://repo.spongepowered.org/repository/maven-public/")
3232
maven("https://repo.viaversion.com")
33+
maven("https://maven.noxcrew.com/public")
3334
}
3435

3536
dependencies {
@@ -51,6 +52,7 @@ dependencies {
5152
api("io.github.dockyardmc:scroll:3.2")
5253
implementation("io.github.dockyardmc:wikivg-datagen:1.3")
5354
api("net.kyori:adventure-nbt:4.21.0")
55+
api("com.noxcrew.noxesium:api:2.7.7")
5456

5557
// Pathfinding
5658
api("com.github.Metaphoriker.pathetic:pathetic-engine:4.0")

src/main/kotlin/io/github/dockyardmc/DockyardServer.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import io.github.dockyardmc.events.ServerFinishLoadEvent
99
import io.github.dockyardmc.events.WorldFinishLoadingEvent
1010
import io.github.dockyardmc.implementations.block.DefaultBlockHandlers
1111
import io.github.dockyardmc.implementations.commands.DefaultCommands
12+
import io.github.dockyardmc.noxesium.Noxesium
1213
import io.github.dockyardmc.profiler.profiler
1314
import io.github.dockyardmc.protocol.NetworkCompression
1415
import io.github.dockyardmc.protocol.packets.configurations.Tag
@@ -101,6 +102,10 @@ class DockyardServer(configBuilder: Config.() -> Unit) {
101102
Events.dispatch(ServerFinishLoadEvent(this))
102103
if (ConfigManager.config.updateChecker) UpdateChecker()
103104

105+
if (ConfigManager.config.implementationConfig.noxesium) {
106+
Noxesium.register()
107+
}
108+
104109
if (InstrumentationUtils.isDebuggerAttached()) {
105110
profiler("Setup hot reload detection") {
106111
InstrumentationUtils.setupHotReloadDetection()
@@ -130,7 +135,7 @@ class DockyardServer(configBuilder: Config.() -> Unit) {
130135
lateinit var versionInfo: Resources.DockyardVersionInfo
131136
lateinit var instance: DockyardServer
132137
val minecraftVersion = MinecraftVersions.v1_21_6
133-
var allowAnyVersion: Boolean = false
138+
var allowAnyVersion: Boolean = true
134139

135140
val scheduler = GlobalScheduler("main_scheduler")
136141

src/main/kotlin/io/github/dockyardmc/advancement/Advancement.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.dockyardmc.advancement
22

33
import cz.lukynka.bindables.BindableList
44
import io.github.dockyardmc.events.EventPool
5+
import io.github.dockyardmc.events.Events
56
import io.github.dockyardmc.events.PlayerLeaveEvent
67
import io.github.dockyardmc.extentions.writeString
78
import io.github.dockyardmc.extentions.writeStringArray
@@ -56,7 +57,7 @@ class Advancement(
5657

5758
override var autoViewable: Boolean = false
5859

59-
private val eventPool = EventPool()
60+
private val eventPool = EventPool(Events, "Advancement Listeners")
6061

6162
init {
6263
require(icon.material != Items.AIR) { "advancement icon can't be air" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package io.github.dockyardmc.annotations
22

3-
annotation class EventDocumentation(val description: String, val cancellable: Boolean)
3+
annotation class EventDocumentation(val description: String, val cancellable: Boolean = false)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package io.github.dockyardmc.codec
2+
3+
import com.google.gson.JsonElement
4+
import io.github.dockyardmc.extentions.readTextComponent
5+
import io.github.dockyardmc.extentions.writeTextComponent
6+
import io.github.dockyardmc.scroll.Component
7+
import io.github.dockyardmc.scroll.extensions.toComponent
8+
import io.github.dockyardmc.tide.Codec
9+
import io.github.dockyardmc.tide.Transcoder
10+
import io.github.dockyardmc.tide.asObjectOrThrow
11+
import io.github.dockyardmc.tide.getPrimitive
12+
import io.netty.buffer.ByteBuf
13+
import net.kyori.adventure.nbt.TagStringIO
14+
15+
object ComponentCodec : Codec<Component> {
16+
17+
override fun writeNetwork(buffer: ByteBuf, value: Component) {
18+
buffer.writeTextComponent(value)
19+
}
20+
21+
override fun readJson(json: JsonElement, field: String): Component {
22+
val nbt = json.getPrimitive<String>(field)
23+
return TagStringIO.get().asCompound(nbt).toComponent()
24+
}
25+
26+
override fun readNetwork(buffer: ByteBuf): Component {
27+
return buffer.readTextComponent()
28+
}
29+
30+
override fun <A> readTranscoded(transcoder: Transcoder<A>, format: A, field: String): Component {
31+
throw UnsupportedOperationException()
32+
}
33+
34+
override fun <A> writeTranscoded(transcoder: Transcoder<A>, format: A, value: Component, field: String) {
35+
throw UnsupportedOperationException()
36+
}
37+
38+
override fun writeJson(json: JsonElement, value: Component, field: String) {
39+
json.asObjectOrThrow().addProperty(field, TagStringIO.get().asString(value.toNBT()))
40+
}
41+
42+
}

src/main/kotlin/io/github/dockyardmc/config/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class ImplementationConfig {
5656
var defaultEntityViewDistanceBlocks: Int = 64
5757
var defaultCommands: Boolean = true
5858
var spark: Boolean = true
59+
var noxesium: Boolean = true
5960
var itemDroppingAndPickup: Boolean = true
6061
}
6162

src/main/kotlin/io/github/dockyardmc/data/DataComponentPatch.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,22 @@ class DataComponentPatch(internal val components: Int2ObjectMap<DataComponent?>,
188188
}.getHashed()
189189
}
190190

191+
fun writeNoxesiumType(buffer: ByteBuf) {
192+
val components = this.components.filter { it.value != null }
193+
val emptyComponents = this.components.filter { it.value == null }
194+
195+
buffer.writeVarInt(components.size)
196+
buffer.writeVarInt(emptyComponents.size)
197+
198+
components.forEach { (key, value) ->
199+
buffer.writeString(DataComponentRegistry.getIdentifierById(key))
200+
value!!.write(buffer)
201+
}
202+
emptyComponents.forEach { (key, _) ->
203+
buffer.writeString(DataComponentRegistry.getIdentifierById(key))
204+
}
205+
}
206+
191207
override fun write(buffer: ByteBuf) {
192208
var added = 0
193209
components.values.forEach { component ->

src/main/kotlin/io/github/dockyardmc/data/DataComponentRegistry.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ object DataComponentRegistry {
1515
val dataComponentsByIdReversed = Object2IntOpenHashMap<KClass<out DataComponent>>()
1616
val dataComponentsByIdentifierReversed = Object2ObjectOpenHashMap<KClass<out DataComponent>, String>()
1717

18+
fun getIdentifierById(id: Int): String {
19+
return dataComponentsByIdentifierReversed.getValue(dataComponentsById.getValue(id))
20+
}
21+
1822
val CUSTOM_DATA = register("minecraft:custom_data", CustomDataComponent::class)
1923
val MAX_STACK_SIZE = register("minecraft:max_stack_size", MaxStackSizeComponent::class)
2024
val MAX_DAMAGE = register("minecraft:max_damage", MaxDamageComponent::class)

src/main/kotlin/io/github/dockyardmc/entity/InteractionEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Interaction(location: Location): Entity(location) {
1717
override val health: Bindable<Float> = bindablePool.provideBindable(0f)
1818
override var inventorySize: Int = 0
1919

20-
private val eventPool = EventPool()
20+
private val eventPool = EventPool(Events, "Interaction Listeners")
2121

2222
val width: Bindable<Float> = bindablePool.provideBindable(1f)
2323
val height: Bindable<Float> = bindablePool.provideBindable(1f)

src/main/kotlin/io/github/dockyardmc/entity/ai/EntityBehaviourCoordinator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.dockyardmc.entity.ai
22

33
import io.github.dockyardmc.entity.Entity
44
import io.github.dockyardmc.events.EventPool
5+
import io.github.dockyardmc.events.Events
56
import io.github.dockyardmc.events.system.EventFilter
67
import io.github.dockyardmc.pathfinding.IsSolidPathFilter
78
import io.github.dockyardmc.pathfinding.Navigator
@@ -16,7 +17,7 @@ import java.util.concurrent.atomic.AtomicBoolean
1617

1718
abstract class EntityBehaviourCoordinator(val entity: Entity) : Freezable(), Disposable {
1819

19-
val eventPool = EventPool().withFilter(EventFilter.containsEntity(entity))
20+
val eventPool = EventPool(Events, "EBC Listeners (${entity::class.simpleName})").withFilter(EventFilter.containsEntity(entity))
2021
val behaviours: MutableList<EntityBehaviourNode> = mutableListOf()
2122
var activeBehaviour: EntityBehaviourNode? = null
2223
private val isEvaluating = AtomicBoolean(false)

0 commit comments

Comments
 (0)