Skip to content

Commit ed76e6c

Browse files
committed
fix 1.8.9 compile
1 parent d67df45 commit ed76e6c

File tree

5 files changed

+45
-52
lines changed

5 files changed

+45
-52
lines changed

legacy/src/main/java/io/github/notenoughupdates/moulconfig/gui/GuiComponentWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void handleKeyboardInput() throws IOException {
7979

8080
if (Keyboard.getEventKeyState())
8181
context.getRoot().keyboardEvent(new KeyboardEvent.CharTyped(Keyboard.getEventCharacter()), createContext());
82-
context.getRoot().keyboardEvent(new KeyboardEvent.KeyPressed(Keyboard.getEventKey(), Keyboard.getEventKeyState()), createContext());
82+
context.getRoot().keyboardEvent(new KeyboardEvent.KeyPressed(Keyboard.getEventKey(), -1, Keyboard.getEventKeyState()), createContext());
8383
}
8484

8585
@Override
@@ -88,7 +88,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
8888
ForgeRenderContext frc = new ForgeRenderContext();
8989
context.getRoot().render(new GuiImmediateContext(
9090
frc,
91-
0, 0, width, height, mouseX, mouseY, mouseX, mouseY , mouseX, mouseY
91+
0, 0, width, height, mouseX, mouseY, mouseX, mouseY, mouseX, mouseY
9292
));
9393
frc.renderExtraLayers();
9494
}

legacy/src/main/java/io/github/notenoughupdates/moulconfig/gui/GuiScreenElementWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void handleMouseInput() throws IOException {
5757

5858
@Override
5959
public void handleKeyboardInput() throws IOException {
60-
if (element.keyboardInput(new KeyboardEvent.KeyPressed(Keyboard.getEventKey(), Keyboard.getEventKeyState())))
60+
if (element.keyboardInput(new KeyboardEvent.KeyPressed(Keyboard.getEventKey(), -1, Keyboard.getEventKeyState())))
6161
return;
6262
if (Keyboard.getEventKeyState() && !Character.isISOControl(Keyboard.getEventCharacter()))
6363
if (element.keyboardInput(new KeyboardEvent.CharTyped(Keyboard.getEventCharacter()))) return;

legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeFontRenderer.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import java.util.regex.Pattern
88

99

1010
class ForgeFontRenderer(val font: FontRenderer) : IFontRenderer {
11-
override val height: Int
12-
get() = font.FONT_HEIGHT
1311

1412
override fun getStringWidth(string: StructuredText): Int {
1513
return font.getStringWidth(StructuredTextImpl.unwrap(string).formattedText)
1614
}
1715

16+
override fun getHeight(): Int {
17+
return font.FONT_HEIGHT
18+
}
19+
1820
override fun getStringWidth(string: String): Int {
1921
return font.getStringWidth(string)
2022
}

legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMinecraft.kt

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,26 @@ class ForgeMinecraft : IMinecraft {
8484
}
8585
}
8686

87-
override val isDevelopmentEnvironment: Boolean
88-
get() = Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
87+
override fun isDevelopmentEnvironment(): Boolean {
88+
return Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
89+
}
8990

90-
override val scaledWidth
91-
get(): Int = ScaledResolution(Minecraft.getMinecraft()).scaledWidth
91+
override fun getScaledWidth(): Int {
92+
return ScaledResolution(Minecraft.getMinecraft()).scaledWidth
93+
}
9294

93-
override val scaledHeight: Int
94-
get() = ScaledResolution(Minecraft.getMinecraft()).scaledHeight
95+
override fun getScaledHeight(): Int {
96+
return ScaledResolution(Minecraft.getMinecraft()).scaledHeight
97+
}
9598

96-
override val scaleFactor: Int
97-
get() = ScaledResolution(Minecraft.getMinecraft()).scaleFactor
99+
override fun getScaleFactor(): Int {
100+
return ScaledResolution(Minecraft.getMinecraft()).scaleFactor
101+
}
98102

99-
override fun sendClickableChatMessage(message: StructuredText, action: String, type: ClickType) {
103+
override fun sendClickableChatMessage(message: StructuredText, action: String, type: ClickType?) {
100104
val component = StructuredTextImpl.unwrap(message)
101-
component.setChatStyle(
102-
component.chatStyle
105+
if (type != null)
106+
component.chatStyle = component.chatStyle
103107
.setChatClickEvent(
104108
ClickEvent(
105109
when (type) {
@@ -108,7 +112,6 @@ class ForgeMinecraft : IMinecraft {
108112
}, action
109113
)
110114
)
111-
)
112115
Minecraft.getMinecraft().ingameGUI.chatGUI.printChatMessage(
113116
component
114117

@@ -201,31 +204,14 @@ class ForgeMinecraft : IMinecraft {
201204
} ?: ""
202205
}
203206

204-
override val mouseX: Int
205-
get() {
206-
val width = scaledWidth
207-
val mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth
208-
return mouseX
209-
}
210-
211-
override val mouseY: Int
212-
get() {
213-
val height = scaledHeight
214-
val mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1
215-
return mouseY
216-
}
217-
override val mouseXHF: Double
218-
get() {
219-
val width = ScaledResolution(Minecraft.getMinecraft()).scaledWidth_double
220-
val mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth
221-
return mouseX
222-
}
223-
override val mouseYHF: Double
224-
get() {
225-
val height = ScaledResolution(Minecraft.getMinecraft()).scaledHeight_double
226-
val mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1
227-
return mouseY
228-
}
207+
override fun getMousePositionHF(): Pair<Double, Double> {
208+
val sr = ScaledResolution(Minecraft.getMinecraft())
209+
val width = sr.scaledWidth_double
210+
val mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth
211+
val height = sr.scaledHeight_double
212+
val mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1
213+
return mouseX to mouseY
214+
}
229215

230216
companion object {
231217
@JvmStatic
@@ -242,11 +228,15 @@ class ForgeMinecraft : IMinecraft {
242228
}
243229
}
244230

245-
override val isOnMacOS: Boolean
246-
get() = Minecraft.isRunningOnMac
231+
override fun isOnMacOs(): Boolean {
232+
return Minecraft.isRunningOnMac
233+
}
247234

248-
override val defaultFontRenderer: IFontRenderer
249-
get() = ForgeFontRenderer(Minecraft.getMinecraft().fontRendererObj)
250-
override val keyboardConstants: IKeyboardConstants
251-
get() = ForgeKeyboardConstants
235+
override fun getDefaultFontRenderer(): IFontRenderer {
236+
return ForgeFontRenderer(Minecraft.getMinecraft().fontRendererObj)
237+
}
238+
239+
override fun getKeyboardConstants(): IKeyboardConstants {
240+
return ForgeKeyboardConstants
241+
}
252242
}

legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeRenderContext.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,17 @@ class ForgeRenderContext : RenderContext {
6060
GlStateManager.color(ColourUtil.unpackARGBRedF(color), ColourUtil.unpackARGBGreenF(color), ColourUtil.unpackARGBBlueF(color), ColourUtil.unpackARGBAlphaF(color))
6161
}
6262

63-
override fun drawColoredTriangles(color: Int, vararg coordinates: Float) {
63+
64+
override fun drawColouredQuads(colour: Int, vararg coordinates: Float) {
6465
val tessellator = Tessellator.getInstance()
6566
val worldrenderer = tessellator.worldRenderer
6667
GlStateManager.enableBlend()
6768
GlStateManager.disableTexture2D()
6869
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0)
69-
worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION)
70+
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION)
7071

71-
applyGlobalColor(color)
72-
require(coordinates.size % 6 == 0)
72+
applyGlobalColor(colour)
73+
require(coordinates.size % 8 == 0)
7374
for (i in 0 until (coordinates.size / 2)) {
7475
worldrenderer.pos(coordinates[i * 2].toDouble(), coordinates[i * 2 + 1].toDouble(), 0.0).endVertex()
7576
}

0 commit comments

Comments
 (0)