@@ -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}
0 commit comments