Skip to content

Commit

Permalink
Port to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nea89o committed Jan 19, 2024
1 parent ccdceb7 commit efb3c25
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
mc_modern = "1.20.2"
mc_modern = "1.20.4"
mc_legacy = "1.8.9"
mcp = "22-1.8.9"
forge_loader = "11.15.1.2318-1.8.9"
fabric_loader = "0.14.22"
fabric_api = "0.89.2+1.20.2"
yarn_build = "1"
fabric_loader = "0.15.6"
fabric_api = "0.95.0+1.20.4"
yarn_build = "3"
lombok = "1.18.26"
jbAnnotations = "24.0.1"
kotlin = "1.8.21"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,19 @@ class ModernMinecraft : IMinecraft {
}

override val mouseX: Int
get() = TODO("Not yet implemented")
get() {
val mouse = MinecraftClient.getInstance().mouse
val window = MinecraftClient.getInstance().window
val x = (mouse.x * window.scaledWidth.toDouble() / window.width.toDouble()).toInt()
return x
}
override val mouseY: Int
get() = TODO("Not yet implemented")
get() {
val mouse = MinecraftClient.getInstance().mouse
val window = MinecraftClient.getInstance().window
val y = (mouse.y * window.scaledHeight.toDouble() / window.height.toDouble()).toInt()
return y
}

override fun loadResourceLocation(resourceLocation: MyResourceLocation): InputStream {
return MinecraftClient.getInstance().resourceManager.getResource(fromMyResourceLocation(resourceLocation))
Expand All @@ -72,9 +82,18 @@ class ModernMinecraft : IMinecraft {
override val keyboardConstants: IKeyboardConstants
get() = ModernKeyboardConstants
override val scaledWidth: Int
get() = TODO("Not yet implemented")
get() {
val window = MinecraftClient.getInstance().window
return window.scaledWidth
}
override val scaledHeight: Int
get() = TODO("Not yet implemented")
get() {
val window = MinecraftClient.getInstance().window
return window.scaledHeight
}
override val scaleFactor: Int
get() = TODO("Not yet implemented")
get() {
val window = MinecraftClient.getInstance().window
return window.scaleFactor.toInt()
}
}

0 comments on commit efb3c25

Please sign in to comment.