Skip to content

Commit e67636a

Browse files
committed
chore: big fixes
1 parent 396ab0e commit e67636a

7 files changed

Lines changed: 180 additions & 70 deletions

File tree

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515

1616
</div>
1717

18-
> [!NOTE]
19-
> This project was made possible thanks to:
20-
> - [Nebula Client](https://nebulaclient.net) (UI Design)
21-
> - [Odin-Fabric](https://github.com/odtheking/Odin) (NVG Impl & Config System)
22-
> - [Vexel](https://github.com/StellariumMC/vexel) (Texture Tracking)
23-
2418
## About The Project
2519

2620
Cobalt is an open-source Minecraft Fabric project focused on providing a modular scripting and automation framework with an emphasis on extensibility. It is designed to be easy to experiment with, extend through addons, and adapt to different use cases without locking users into a rigid structure.

src/main/java/org/cobalt/mixin/render/GlStateManagerMixin.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
import org.spongepowered.asm.mixin.injection.Inject;
88
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
99

10-
/**
11-
* Implementation from vexel by StellariumMC
12-
* Original work: <a href="https://github.com/StellariumMC/vexel">...</a>
13-
*
14-
* @author StellariumMC
15-
*/
1610
@Mixin(GlStateManager.class)
1711
public class GlStateManagerMixin {
1812

src/main/kotlin/org/cobalt/api/util/ui/NVGRenderer.kt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2023-2025, odtheking
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of the copyright holder nor the names of its
17+
* contributors may be used to endorse or promote products derived from
18+
* this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*
31+
* Portions of this file are derived from OdinFabric
32+
* Copyright (c) odtheking
33+
* Licensed under BSD-3-Clause
34+
*
35+
* Modifications and additions:
36+
* Licensed under GPL-3.0
37+
*/
38+
139
package org.cobalt.api.util.ui
240

341
import com.mojang.blaze3d.opengl.GlDevice
@@ -23,12 +61,6 @@ import org.lwjgl.stb.STBImage.stbi_load_from_memory
2361
import org.lwjgl.system.MemoryUtil.memAlloc
2462
import org.lwjgl.system.MemoryUtil.memFree
2563

26-
/**
27-
* Implementation from OdinFabric
28-
* Original work: https://github.com/odtheking/OdinFabric
29-
*
30-
* @author OdinFabric
31-
*/
3264
@Suppress("unused")
3365
object NVGRenderer {
3466

src/main/kotlin/org/cobalt/api/util/ui/TextureTracker.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package org.cobalt.api.util.ui
22

3-
/**
4-
* Implementation from vexel by StellariumMC
5-
* Original work: https://github.com/StellariumMC/vexel
6-
*
7-
* @author StellariumMC
8-
*/
93
object TextureTracker {
104

115
@JvmStatic
Lines changed: 66 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,71 @@
1-
package org.cobalt.api.util.ui.helper
2-
3-
import java.io.FileNotFoundException
4-
import java.nio.ByteBuffer
5-
import java.nio.ByteOrder
6-
7-
/**
8-
* Implementation from OdinFabric
9-
* Original work: https://github.com/odtheking/OdinFabric
10-
*
11-
* @author OdinFabric
12-
*/
13-
class Font(val name: String, private val resourcePath: String) {
14-
15-
private var cachedBytes: ByteArray? = null
16-
17-
fun buffer(): ByteBuffer {
18-
val bytes = cachedBytes ?: run {
19-
val stream = this::class.java.getResourceAsStream(resourcePath)
20-
?: throw FileNotFoundException(resourcePath)
21-
22-
stream.use { it.readBytes() }.also { cachedBytes = it }
23-
}
24-
25-
return ByteBuffer.allocateDirect(bytes.size)
26-
.order(ByteOrder.nativeOrder())
27-
.put(bytes)
28-
.flip() as ByteBuffer
29-
}
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2023-2025, odtheking
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of the copyright holder nor the names of its
17+
* contributors may be used to endorse or promote products derived from
18+
* this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*
31+
* Portions of this file are derived from OdinFabric
32+
* Copyright (c) odtheking
33+
* Licensed under BSD-3-Clause
34+
*
35+
* Modifications and additions:
36+
* Licensed under GPL-3.0
37+
*/
3038

31-
override fun hashCode(): Int {
32-
return name.hashCode()
33-
}
39+
package org.cobalt.api.util.ui.helper
40+
41+
import java.io.FileNotFoundException
42+
import java.nio.ByteBuffer
43+
import java.nio.ByteOrder
44+
45+
class Font(val name: String, private val resourcePath: String) {
46+
47+
private var cachedBytes: ByteArray? = null
48+
49+
fun buffer(): ByteBuffer {
50+
val bytes = cachedBytes ?: run {
51+
val stream = this::class.java.getResourceAsStream(resourcePath)
52+
?: throw FileNotFoundException(resourcePath)
3453

35-
override fun equals(other: Any?): Boolean {
36-
return other is Font && name == other.name
54+
stream.use { it.readBytes() }.also { cachedBytes = it }
3755
}
3856

57+
return ByteBuffer.allocateDirect(bytes.size)
58+
.order(ByteOrder.nativeOrder())
59+
.put(bytes)
60+
.flip() as ByteBuffer
3961
}
62+
63+
override fun hashCode(): Int {
64+
return name.hashCode()
65+
}
66+
67+
override fun equals(other: Any?): Boolean {
68+
return other is Font && name == other.name
69+
}
70+
71+
}

src/main/kotlin/org/cobalt/api/util/ui/helper/Gradient.kt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,43 @@
1-
package org.cobalt.api.util.ui.helper
2-
3-
/**
4-
* Implementation from OdinFabric
5-
* Original work: https://github.com/odtheking/OdinFabric
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2023-2025, odtheking
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
615
*
7-
* @author OdinFabric
16+
* 3. Neither the name of the copyright holder nor the names of its
17+
* contributors may be used to endorse or promote products derived from
18+
* this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*
31+
* Portions of this file are derived from OdinFabric
32+
* Copyright (c) odtheking
33+
* Licensed under BSD-3-Clause
34+
*
35+
* Modifications and additions:
36+
* Licensed under GPL-3.0
837
*/
38+
39+
package org.cobalt.api.util.ui.helper
40+
941
enum class Gradient {
1042
LeftToRight,
1143
TopToBottom,

src/main/kotlin/org/cobalt/api/util/ui/helper/Image.kt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2023-2025, odtheking
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of the copyright holder nor the names of its
17+
* contributors may be used to endorse or promote products derived from
18+
* this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*
31+
* Portions of this file are derived from OdinFabric
32+
* Copyright (c) odtheking
33+
* Licensed under BSD-3-Clause
34+
*
35+
* Modifications and additions:
36+
* Licensed under GPL-3.0
37+
*/
38+
139
package org.cobalt.api.util.ui.helper
240

341
import java.io.File
@@ -8,12 +46,6 @@ import java.nio.file.Files
846
import org.cobalt.api.util.setupConnection
947
import org.lwjgl.system.MemoryUtil
1048

11-
/**
12-
* Implementation from OdinFabric
13-
* Original work: https://github.com/odtheking/OdinFabric
14-
*
15-
* @author OdinFabric
16-
*/
1749
class Image(
1850
val identifier: String,
1951
var isSVG: Boolean = false,

0 commit comments

Comments
 (0)