Skip to content

Commit f4d9d24

Browse files
committed
Fix triangles on modern versions
1 parent 1e35446 commit f4d9d24

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/platform/ModernRenderContext.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ModernRenderContext(val drawContext: DrawContext) : RenderContext {
3939
.colorLogic(RenderPhase.OR_REVERSE)
4040
.build(false)
4141
)
42-
val COLORED_TRIANGLES = Util.memoize { it: Identifier ->
42+
val COLORED_TRIANGLES =
4343
RenderLayer.of(
4444
"mc_triangles",
4545
VertexFormats.POSITION_COLOR,
@@ -49,13 +49,11 @@ class ModernRenderContext(val drawContext: DrawContext) : RenderContext {
4949
false,
5050
RenderLayer.MultiPhaseParameters.builder()
5151
// TODO: import mipmap settings
52-
.texture(RenderPhase.Texture(it, TriState.DEFAULT, false))
53-
.program(RenderPhase.ShaderProgram(ShaderProgramKeys.POSITION_TEX_COLOR))
52+
.program(RenderPhase.ShaderProgram(ShaderProgramKeys.POSITION_COLOR))
5453
.transparency(RenderPhase.TRANSLUCENT_TRANSPARENCY)
5554
.depthTest(RenderPhase.LEQUAL_DEPTH_TEST)
5655
.build(false)
5756
)
58-
}
5957
}
6058

6159
val mouse = MinecraftClient.getInstance().mouse
@@ -148,7 +146,7 @@ class ModernRenderContext(val drawContext: DrawContext) : RenderContext {
148146
require(coordinates.size % 6 == 0)
149147
RenderSystem.enableBlend()
150148
drawContext.draw {
151-
val buf = it.getBuffer(COLORED_TRIANGLES.apply(ModernMinecraft.boundTexture))
149+
val buf = it.getBuffer(COLORED_TRIANGLES)
152150
val matrix = drawContext.matrices.peek().positionMatrix
153151

154152
for (i in 0 until (coordinates.size / 2)) {

modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/test/TestCategoryA.kt

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
package io.github.notenoughupdates.moulconfig.test
22

33
import com.google.gson.annotations.Expose
4-
import io.github.notenoughupdates.moulconfig.annotations.*
4+
import io.github.notenoughupdates.moulconfig.annotations.Accordion
5+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean
6+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList
7+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown
8+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorInfoText
9+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorKeybind
10+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider
11+
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText
12+
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption
513
import io.github.notenoughupdates.moulconfig.observer.Property
614
import org.lwjgl.glfw.GLFW
7-
import java.util.*
15+
import java.util.Arrays
816

917
class TestCategoryA {
1018
@ConfigOption(name = "Test Option", desc = "Test toggle")
@@ -29,21 +37,29 @@ class TestCategoryA {
2937
}
3038

3139

32-
@ConfigOption(name = "Number Dropdown", desc = "0, 1, 2, 3")
33-
@ConfigEditorDropdown(values = ["0", "1", "2", "3"])
34-
var numberDropdown: Int = 0
40+
@Accordion
41+
@ConfigOption(name = "Accordion", desc = "")
42+
var accordion = AccordionClass()
3543

44+
class AccordionClass() {
45+
46+
@ConfigOption(name = "Number Dropdown", desc = "0, 1, 2, 3")
47+
@ConfigEditorDropdown(values = ["0", "1", "2", "3"])
48+
var numberDropdown: Int = 0
3649

37-
@ConfigOption(name = "Enum Dropdown", desc = "1, 2, 3, 4")
38-
@ConfigEditorDropdown
39-
var enumDropdown: Property<DropdownEnum> = Property.of(DropdownEnum.FOUR)
50+
51+
@ConfigOption(name = "Enum Dropdown", desc = "1, 2, 3, 4")
52+
@ConfigEditorDropdown
53+
var enumDropdown: Property<DropdownEnum> = Property.of(DropdownEnum.FOUR)
54+
}
4055

4156
enum class DropdownEnum(private val label: String) {
4257
ONE("1"),
4358
TWO("2"),
4459
THREE("3"),
4560
FOUR("4"),
4661
;
62+
4763
override fun toString(): String {
4864
return label
4965
}
@@ -65,7 +81,7 @@ class TestCategoryA {
6581

6682
@ConfigOption(name = "Draggable List", desc = "§eDrag text to change the order of the list.")
6783
@ConfigEditorDraggableList(
68-
exampleText = ["abc", "dec", "blah","surel it works really cool and great :))"]
84+
exampleText = ["abc", "dec", "blah", "surel it works really cool and great :))"]
6985
)
7086
var draggableList: List<Int> = ArrayList(mutableListOf(0, 1, 2, 3))
7187

0 commit comments

Comments
 (0)