craftground-runtime-mc121 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. craftground_runtime_mc121/LICENSE +2 -0
  2. craftground_runtime_mc121/PKG-INFO +81 -0
  3. craftground_runtime_mc121/README.md +68 -0
  4. craftground_runtime_mc121/__init__.py +1 -0
  5. craftground_runtime_mc121/build.gradle +307 -0
  6. craftground_runtime_mc121/gradle/wrapper/gradle-wrapper.jar +0 -0
  7. craftground_runtime_mc121/gradle/wrapper/gradle-wrapper.properties +6 -0
  8. craftground_runtime_mc121/gradle.properties +19 -0
  9. craftground_runtime_mc121/gradlew +186 -0
  10. craftground_runtime_mc121/gradlew.bat +89 -0
  11. craftground_runtime_mc121/mods_to_include.txt +2 -0
  12. craftground_runtime_mc121/settings.gradle +9 -0
  13. craftground_runtime_mc121/src/main/cpp/CMakeLists.txt +169 -0
  14. craftground_runtime_mc121/src/main/cpp/boost_ipc.cpp +290 -0
  15. craftground_runtime_mc121/src/main/cpp/cursor.cpp +288 -0
  16. craftground_runtime_mc121/src/main/cpp/depth_capture.cpp +268 -0
  17. craftground_runtime_mc121/src/main/cpp/framebuffer_capturer.cpp +302 -0
  18. craftground_runtime_mc121/src/main/cpp/framebuffer_capturer_apple.mm +155 -0
  19. craftground_runtime_mc121/src/main/cpp/framebuffer_capturer_cuda.cpp +227 -0
  20. craftground_runtime_mc121/src/main/cpp/include/cross_gl.h +18 -0
  21. craftground_runtime_mc121/src/main/cpp/include/cross_semaphore.h +95 -0
  22. craftground_runtime_mc121/src/main/cpp/include/cursor.h +7 -0
  23. craftground_runtime_mc121/src/main/cpp/include/depth_capture.h +12 -0
  24. craftground_runtime_mc121/src/main/cpp/include/framebuffer_capturer.h +7 -0
  25. craftground_runtime_mc121/src/main/cpp/include/framebuffer_capturer_apple.h +13 -0
  26. craftground_runtime_mc121/src/main/cpp/include/framebuffer_capturer_cuda.h +21 -0
  27. craftground_runtime_mc121/src/main/cpp/include/png_util.h +20 -0
  28. craftground_runtime_mc121/src/main/cpp/include/rgb_capture.h +3 -0
  29. craftground_runtime_mc121/src/main/cpp/jni/jni_cuda_zerocopy.cpp +117 -0
  30. craftground_runtime_mc121/src/main/cpp/jni/jni_dummy_zerocopy.cpp +79 -0
  31. craftground_runtime_mc121/src/main/cpp/jni/jni_macos_zerocopy.cpp +88 -0
  32. craftground_runtime_mc121/src/main/cpp/noboost_ipc.cpp +504 -0
  33. craftground_runtime_mc121/src/main/cpp/png_util.cpp +52 -0
  34. craftground_runtime_mc121/src/main/cpp/rgb_capture.cpp +22 -0
  35. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/AddListenerInterface.java +17 -0
  36. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/BiomeCenterFinder.kt +110 -0
  37. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/ChatMessageRecord.kt +6 -0
  38. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/CollisionListener.kt +14 -0
  39. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/CsvLogger.kt +40 -0
  40. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/EncodeImageToBytes.kt +31 -0
  41. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/EntityRenderListener.kt +9 -0
  42. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/EntityRenderListenerImpl.kt +23 -0
  43. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/EnvironmentInitializer.kt +710 -0
  44. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/FramebufferCapturer.kt +197 -0
  45. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/GameRendererDepthCaptureMixinGetterInterface.java +5 -0
  46. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/GetMessagesInterface.java +12 -0
  47. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/HeightMapProvider.kt +39 -0
  48. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/KeyboardInfo.kt +104 -0
  49. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/MessageIO.kt +217 -0
  50. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/MinecraftEnv.kt +1092 -0
  51. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/MinecraftSoundListener.kt +85 -0
  52. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/MouseInfo.kt +103 -0
  53. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/Point3D.java +3 -0
  54. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/PrintWithTime.kt +25 -0
  55. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/TickSpeed.kt +5 -0
  56. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/TickSynchronizer.kt +83 -0
  57. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/ToMessage.kt +79 -0
  58. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/client/Minecraft_envClient.java +33 -0
  59. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/customentity/ModelCache.kt +45 -0
  60. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/customentity/OBJLoader.kt +77 -0
  61. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/customentity/RealisticHuman.kt +10 -0
  62. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/customentity/RealisticHumanModel.kt +90 -0
  63. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/customentity/RealisticHumanRenderer.kt +81 -0
  64. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/AbstractBlockCollisionDetectorMixin.java +42 -0
  65. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ChatVisibleMessageAccessor.java +12 -0
  66. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientCommonNetworkHandlerClientAccessor.java +11 -0
  67. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientEntityRenderDispatcherAccessor.java +11 -0
  68. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientIsWindowFocusedMixin.java +13 -0
  69. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientPlayNetworkHandlerMixin.java +27 -0
  70. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientRenderInvoker.java +11 -0
  71. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ClientWorldMixin.java +25 -0
  72. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/DisableRegionalComplianceMixin.java +19 -0
  73. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/EntityCollisionDetectorMixin.java +44 -0
  74. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/GameRendererDepthCaptureMixin.java +70 -0
  75. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/GammaMixin.java +57 -0
  76. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/InputUtilMixin.java +41 -0
  77. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/MinecraftServer_tickspeedMixin.java +218 -0
  78. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/MouseXYAccessor.java +14 -0
  79. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/RenderLayerTrianglesMixin.java +58 -0
  80. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/RenderMixin.java +38 -0
  81. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/RenderSystemPollEventsInvoker.java +10 -0
  82. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/RenderTickCounterAccessor.java +17 -0
  83. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/SaveWorldMixin.java +16 -0
  84. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/ServerPlayNetworkHandlerDisableSpamChecker.java +15 -0
  85. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/TickSpeedMixin.java +29 -0
  86. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/WindowOffScreenMixin.java +20 -0
  87. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/WindowSizeAccessor.java +13 -0
  88. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/mixin/WorldRendererCallEntityRenderMixin.java +44 -0
  89. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ActionSpace.java +2314 -0
  90. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ActionSpaceKt.kt +8 -0
  91. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ActionSpaceKt.proto.kt +8 -0
  92. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ActionSpaceMessageV2Kt.kt +503 -0
  93. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/BiomeInfoKt.kt +135 -0
  94. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/BlockCollisionInfoKt.kt +103 -0
  95. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/BlockInfoKt.kt +103 -0
  96. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ChatMessageInfoKt.kt +94 -0
  97. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/EntitiesWithinDistanceKt.kt +107 -0
  98. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/EntityCollisionInfoKt.kt +103 -0
  99. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/EntityInfoKt.kt +188 -0
  100. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/HeightInfoKt.kt +103 -0
  101. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/HitResultKt.kt +119 -0
  102. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/InitialEnvironment.java +6542 -0
  103. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/InitialEnvironmentKt.kt +8 -0
  104. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/InitialEnvironmentKt.proto.kt +8 -0
  105. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/InitialEnvironmentMessageKt.kt +1253 -0
  106. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ItemStackKt.kt +120 -0
  107. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/LidarConfigKt.kt +160 -0
  108. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/LidarRayKt.kt +185 -0
  109. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/LidarResultKt.kt +210 -0
  110. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/NearbyBiomeKt.kt +103 -0
  111. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ObservationSpace.java +21237 -0
  112. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ObservationSpaceKt.kt +8 -0
  113. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ObservationSpaceKt.proto.kt +8 -0
  114. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/ObservationSpaceMessageKt.kt +1636 -0
  115. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/SoundEntryKt.kt +120 -0
  116. craftground_runtime_mc121/src/main/java/com/kyhsgeekcode/minecraftenv/proto/StatusEffectKt.kt +86 -0
  117. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/models/external/human.mtl +12 -0
  118. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/models/external/human.obj +2695 -0
  119. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/models/external/human_texture_triangle.png +0 -0
  120. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/models/external/sphere.obj +2406 -0
  121. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/textures/entity/human_texture_triangle.png +0 -0
  122. craftground_runtime_mc121/src/main/resources/assets/minecraftenv/textures/entity/skull_and_roses_triangles.png +0 -0
  123. craftground_runtime_mc121/src/main/resources/com.kyhsgeekcode.minecraftenv.mixin.json +38 -0
  124. craftground_runtime_mc121/src/main/resources/fabric.mod.json +38 -0
  125. craftground_runtime_mc121/src/main/resources/minecraftenv.accesswidener +6 -0
  126. craftground_runtime_mc121-0.1.0.dist-info/METADATA +81 -0
  127. craftground_runtime_mc121-0.1.0.dist-info/RECORD +130 -0
  128. craftground_runtime_mc121-0.1.0.dist-info/WHEEL +5 -0
  129. craftground_runtime_mc121-0.1.0.dist-info/licenses/LICENSE +2 -0
  130. craftground_runtime_mc121-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2 @@
1
+ Copyright (c) 2023
2
+ All rights reserved.
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: craftground-runtime-mc121
3
+ Version: 0.1.0
4
+ Summary: CraftGround Fabric mod runtime assets for Minecraft 1.21
5
+ License: Copyright (c) 2023
6
+ All rights reserved.
7
+
8
+ Project-URL: Source, https://github.com/yhs0602/CraftGround
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # MinecraftEnv
15
+
16
+ Lightweight minecraft RL environment on fabric
17
+
18
+ # Features
19
+
20
+ - Works on minecraft 1.21
21
+ - Used fabric mod
22
+ - JDK: 21
23
+
24
+ # initial environment
25
+ - Inventory commands
26
+ - Entities
27
+ - World seed
28
+ - is world superflat
29
+ - is hardcore
30
+ - initial x, y, z
31
+ - always night / day
32
+ - do mob spawn
33
+ - screen size (visible/observed)
34
+ - Arbitrary commands (e.g. status effects)
35
+ - keys for statistics
36
+ - Hud is visible
37
+
38
+ # Observation space
39
+
40
+ - rgb
41
+ - x, y, z
42
+ - pitch, yaw
43
+ - health, food_level, saturation_level
44
+ - is_dead
45
+ - inventory
46
+ - looking at entites, blocks
47
+ - sound subtitles
48
+ - status effects
49
+ - statistics
50
+ - visible entities
51
+ - surrounding entities
52
+ - is bobber thrown
53
+
54
+ # Action space
55
+
56
+ - Similar to https://docs.minedojo.org/sections/core_api/action_space.html
57
+ - No crafting yet
58
+ - Arbitrary command (you should hide this for the agents)
59
+
60
+ Controlled by this reinforcement learning agent: https://github.com/yhs0602/CraftGround
61
+
62
+ renderDistance:6
63
+ simulationDistance:6
64
+
65
+
66
+ # Build cpp
67
+ ```
68
+ mkdir build
69
+ cd build
70
+ cmake ../src/main/cpp
71
+ ```
72
+
73
+ # Docs on MinecraftEnv.kt
74
+ ## ResetPhase
75
+ 1. Initial: END_RESET
76
+ 2. After reading initial environment: WAIT_INIT_ENDS
77
+
78
+ ## IOPhase
79
+ 1. Initial: BEGINNING
80
+ 2. After reading initial environment: GOT_INITIAL_ENVIRONMENT_SHOULD_SEND_OBSERVATION
81
+ 3.
@@ -0,0 +1,68 @@
1
+ # MinecraftEnv
2
+
3
+ Lightweight minecraft RL environment on fabric
4
+
5
+ # Features
6
+
7
+ - Works on minecraft 1.21
8
+ - Used fabric mod
9
+ - JDK: 21
10
+
11
+ # initial environment
12
+ - Inventory commands
13
+ - Entities
14
+ - World seed
15
+ - is world superflat
16
+ - is hardcore
17
+ - initial x, y, z
18
+ - always night / day
19
+ - do mob spawn
20
+ - screen size (visible/observed)
21
+ - Arbitrary commands (e.g. status effects)
22
+ - keys for statistics
23
+ - Hud is visible
24
+
25
+ # Observation space
26
+
27
+ - rgb
28
+ - x, y, z
29
+ - pitch, yaw
30
+ - health, food_level, saturation_level
31
+ - is_dead
32
+ - inventory
33
+ - looking at entites, blocks
34
+ - sound subtitles
35
+ - status effects
36
+ - statistics
37
+ - visible entities
38
+ - surrounding entities
39
+ - is bobber thrown
40
+
41
+ # Action space
42
+
43
+ - Similar to https://docs.minedojo.org/sections/core_api/action_space.html
44
+ - No crafting yet
45
+ - Arbitrary command (you should hide this for the agents)
46
+
47
+ Controlled by this reinforcement learning agent: https://github.com/yhs0602/CraftGround
48
+
49
+ renderDistance:6
50
+ simulationDistance:6
51
+
52
+
53
+ # Build cpp
54
+ ```
55
+ mkdir build
56
+ cd build
57
+ cmake ../src/main/cpp
58
+ ```
59
+
60
+ # Docs on MinecraftEnv.kt
61
+ ## ResetPhase
62
+ 1. Initial: END_RESET
63
+ 2. After reading initial environment: WAIT_INIT_ENDS
64
+
65
+ ## IOPhase
66
+ 1. Initial: BEGINNING
67
+ 2. After reading initial environment: GOT_INITIAL_ENVIRONMENT_SHOULD_SEND_OBSERVATION
68
+ 3.
@@ -0,0 +1 @@
1
+ """CraftGround runtime assets for Minecraft 1.21 (Fabric mod source + Gradle project)."""
@@ -0,0 +1,307 @@
1
+ plugins {
2
+ id 'fabric-loom' version '1.6-SNAPSHOT'
3
+ id 'maven-publish'
4
+ id "org.jetbrains.kotlin.jvm" version "2.0.0"
5
+ // id "com.google.protobuf" version "0.9.2"
6
+ id 'com.github.johnrengelman.shadow' version '7.0.0'
7
+ }
8
+
9
+ shadowJar {
10
+ archiveClassifier.set('')
11
+ }
12
+
13
+ def findVcpkgRoot() {
14
+ try {
15
+ def vcpkgRoot = System.getenv('VCPKG_ROOT')
16
+ if (vcpkgRoot) {
17
+ return vcpkgRoot
18
+ }
19
+ def os = org.gradle.internal.os.OperatingSystem.current()
20
+
21
+ if (os.isWindows()) {
22
+ def process = new ProcessBuilder("cmd", "/c", "where vcpkg").start()
23
+ process.waitFor()
24
+ def output = process.inputStream.text.trim()
25
+ if (output) {
26
+ def vcpkgDir = new File(output).getParentFile()
27
+ return vcpkgDir.absolutePath
28
+ } else {
29
+ throw new RuntimeException("Cannot find vcpkg root")
30
+ }
31
+ } else {
32
+ def process = new ProcessBuilder("bash", "-c", "which vcpkg").start()
33
+ process.waitFor()
34
+ def output = process.inputStream.text.trim()
35
+ if (output) {
36
+ def vcpkgDir = new File(output).getParentFile()
37
+ return vcpkgDir.absolutePath
38
+ } else {
39
+ throw new RuntimeException("Cannot find vcpkg root")
40
+ }
41
+ }
42
+ } catch (Exception e) {
43
+ println "Cannot find vcpkg root: " + e
44
+ return null
45
+ }
46
+ }
47
+
48
+ tasks.register('configureCppProject', Exec) {
49
+ def useConda = System.getenv('CRAFTGROUND_USE_CONDA')?.toBoolean() ?: false
50
+ def os = org.gradle.internal.os.OperatingSystem.current()
51
+ def vcpkgRoot = findVcpkgRoot()
52
+ def vcpkgToolchainFile = vcpkgRoot ? "${vcpkgRoot}/scripts/buildsystems/vcpkg.cmake" : null
53
+ project.logger.lifecycle('Use conda: ' + useConda + ', vcpkg root: ' + vcpkgRoot)
54
+
55
+ def cmakeArgs = ['cmake', '-DCMAKE_POLICY_VERSION_MINIMUM=3.5']
56
+
57
+ if (os.isWindows() && vcpkgToolchainFile && file(vcpkgToolchainFile).exists()) {
58
+ project.logger.lifecycle('Using vcpkg toolchain file: ' + vcpkgToolchainFile)
59
+ cmakeArgs += "-DCMAKE_TOOLCHAIN_FILE=${vcpkgToolchainFile}"
60
+ } else {
61
+ project.logger.lifecycle('Using default cmake, not using vcpkg')
62
+ }
63
+
64
+ if (useConda) {
65
+ cmakeArgs += "-DCMAKE_PREFIX_PATH=$CONDA_PREFIX"
66
+ }
67
+
68
+ cmakeArgs += 'src/main/cpp'
69
+ commandLine cmakeArgs
70
+
71
+ inputs.dir("src/main/cpp")
72
+ outputs.files("MakeFile", "CMakeCache.txt", "cmake_install.cmake")
73
+ outputs.dir("CMakeFiles")
74
+ }
75
+
76
+
77
+ tasks.register('compileCpp', Exec) {
78
+ commandLine 'cmake', '--build', '.', '--config', 'Release', '--parallel', '8'
79
+ inputs.dir("src/main/cpp")
80
+ def os = org.gradle.internal.os.OperatingSystem.current()
81
+ if (os.isLinux()) {
82
+ outputs.file("libnative-lib.so")
83
+ } else if (os.isMacOsX()) {
84
+ outputs.file("libnative-lib.dylib")
85
+ } else if (os.isWindows()) {
86
+ outputs.files(file("Debug/native-lib.dll"), file("Release/native-lib.dll"))
87
+ }
88
+ dependsOn 'configureCppProject'
89
+
90
+ // Copy the built native library to the project root (Only for Windows)
91
+ doLast {
92
+ if (os.isWindows()) {
93
+ // Copy the built native library to the project root
94
+ def debugOutput = new File("Debug/native-lib.dll")
95
+ def releaseOutput = new File("Release/native-lib.dll")
96
+ def targetDir = new File("./native-lib.dll") // Copy to the project root
97
+
98
+ if (releaseOutput.exists()) {
99
+ copy {
100
+ from releaseOutput
101
+ into targetDir.parentFile
102
+ }
103
+ println "Copied ${releaseOutput} to ${targetDir}"
104
+ } else if (debugOutput.exists()) {
105
+ copy {
106
+ from debugOutput
107
+ into targetDir.parentFile
108
+ }
109
+ println "Copied ${debugOutput} to ${targetDir}"
110
+ } else {
111
+ throw new RuntimeException("Cannot find the built native library")
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ tasks.named('runClient').configure {
118
+ dependsOn compileCpp
119
+ }
120
+
121
+ tasks.named('build').configure {
122
+ dependsOn compileCpp
123
+ }
124
+
125
+ tasks.named('runClient') {
126
+ doFirst {
127
+ def maxMemory = System.getenv("CRAFTGROUND_JVM_MAX_MEMORY") ?: "3G"
128
+ def enabledJmx = System.getenv("CRAFTGROUND_JVM_JMX_ENABLED") ?: "false"
129
+ def nativeMemoryTracking = System.getenv("CRAFTGROUND_JVM_NATIVE_TRACKING") ?: "summary"
130
+ jvmArgs += "-Djava.library.path=${projectDir}"
131
+ jvmArgs += "-XX:+UnlockExperimentalVMOptions"
132
+ jvmArgs += "-XX:G1NewSizePercent=40"
133
+ jvmArgs += "-XX:G1MaxNewSizePercent=50"
134
+ jvmArgs += "-XX:G1ReservePercent=20"
135
+ jvmArgs += "-XX:MaxTenuringThreshold=1"
136
+ jvmArgs += "-XX:SurvivorRatio=32"
137
+ jvmArgs += "-XX:+AlwaysPreTouch"
138
+ jvmArgs += "-Xmx${maxMemory}" // Max memory from environment variable
139
+ jvmArgs += "-XX:NativeMemoryTracking=${nativeMemoryTracking}"
140
+ jvmArgs += "-XX:MaxDirectMemorySize=512m"
141
+ jvmArgs += "-XX:MaxMetaspaceSize=1024m" // 1G
142
+ jvmArgs += "-XX:MaxRAM=10G"
143
+ if (enabledJmx.toBoolean()) {
144
+ def jmxPort = System.getenv("CRAFTGROUND_JVM_JMX_PORT") ?: "9010"
145
+ def jmxHost = System.getenv("CRAFTGROUND_JVM_JMX_HOST") ?: "localhost"
146
+ jvmArgs += "-Dcom.sun.management.jmxremote"
147
+ jvmArgs += "-Dcom.sun.management.jmxremote.port=${jmxPort}"
148
+ jvmArgs += "-Dcom.sun.management.jmxremote.ssl=false"
149
+ jvmArgs += "-Dcom.sun.management.jmxremote.authenticate=false"
150
+ jvmArgs += "-Djava.rmi.server.hostname=${jmxHost}"
151
+ }
152
+ // environment.put("LD_PRELOAD", "libjemalloc.so")
153
+ }
154
+ }
155
+
156
+ version = project.mod_version
157
+ group = project.maven_group
158
+
159
+ repositories {
160
+ mavenCentral()
161
+ // Add repositories to retrieve artifacts from in here.
162
+ // You should only use this when depending on other mods because
163
+ // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
164
+ // See https://docs.gradle.org/current/userguide/declaring_repositories.html
165
+ // for more information about repositories.
166
+ maven {
167
+ name = "Modrinth"
168
+ url = "https://api.modrinth.com/maven"
169
+ content {
170
+ includeGroup "maven.modrinth"
171
+ }
172
+ }
173
+ maven {
174
+ url "https://maven.flashyreese.me/releases"
175
+ }
176
+ maven {
177
+ url "https://maven.flashyreese.me/snapshots"
178
+ }
179
+ }
180
+
181
+ dependencies {
182
+ // To change the versions see the gradle.properties file
183
+ minecraft "com.mojang:minecraft:${project.minecraft_version}"
184
+ mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
185
+ modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
186
+
187
+ // Fabric API. This is technically optional, but you probably want it anyway.
188
+ modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
189
+ // https://mvnrepository.com/artifact/maven.modrinth/sodium
190
+ // modApi include("maven.modrinth:sodium:mc1.20-0.4.10")
191
+ // Download this mods from curseforge and modrinth, and put it in the mods folder
192
+ // modRuntimeOnly "maven.modrinth:lithium:mc1.21-0.12.7"
193
+ // modRuntimeOnly "curse.maven:ferritecore-fabric-459857:5434182"
194
+
195
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
196
+ implementation "io.grpc:grpc-kotlin-stub:1.3.0"
197
+ implementation 'com.google.protobuf:protobuf-kotlin:4.29.2'
198
+ implementation "com.github.ben-manes.caffeine:caffeine:3.1.8"
199
+ }
200
+
201
+ processResources {
202
+ inputs.property "version", project.version
203
+ inputs.property "minecraft_version", project.minecraft_version
204
+ inputs.property "loader_version", project.loader_version
205
+ filteringCharset "UTF-8"
206
+
207
+ filesMatching("fabric.mod.json") {
208
+ expand "version": project.version,
209
+ "minecraft_version": project.minecraft_version,
210
+ "loader_version": project.loader_version
211
+ }
212
+ }
213
+
214
+ def targetJavaVersion = 21
215
+ tasks.withType(JavaCompile).configureEach {
216
+ // ensure that the encoding is set to UTF-8, no matter what the system default is
217
+ // this fixes some edge cases with special characters not displaying correctly
218
+ // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
219
+ // If Javadoc is generated, this must be specified in that task too.
220
+ it.options.encoding = "UTF-8"
221
+ if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
222
+ it.options.release = targetJavaVersion
223
+ }
224
+ }
225
+
226
+ java {
227
+ def javaVersion = JavaVersion.toVersion(targetJavaVersion)
228
+ if (JavaVersion.current() < javaVersion) {
229
+ toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
230
+ }
231
+ archivesBaseName = project.archives_base_name
232
+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
233
+ // if it is present.
234
+ // If you remove this line, sources will not be generated.
235
+ withSourcesJar()
236
+ sourceCompatibility = JavaVersion.VERSION_21
237
+ targetCompatibility = JavaVersion.VERSION_21
238
+ }
239
+
240
+ loom {
241
+ accessWidenerPath = file("src/main/resources/minecraftenv.accesswidener")
242
+ }
243
+
244
+
245
+ //protobuf {
246
+ // protoc {
247
+ // artifact = "com.google.protobuf:protoc:3.22.3"
248
+ // }
249
+ // plugins {
250
+ // grpc {
251
+ // artifact = "io.grpc:protoc-gen-grpc-java:1.54.1"
252
+ // }
253
+ // grpckt {
254
+ // artifact = "io.grpc:protoc-gen-grpc-kotlin:1.3.0:jdk8@jar"
255
+ // }
256
+ // }
257
+ // generateProtoTasks {
258
+ // all().forEach {
259
+ // it.plugins {
260
+ // grpc
261
+ // grpckt
262
+ // }
263
+ // it.builtins {
264
+ // kotlin
265
+ // }
266
+ // }
267
+ // }
268
+ //}
269
+
270
+ jar {
271
+ from("LICENSE") {
272
+ rename { "${it}_${project.archivesBaseName}" }
273
+ }
274
+ }
275
+
276
+ // configure the maven publication
277
+ publishing {
278
+ publications {
279
+ mavenJava(MavenPublication) {
280
+ from components.java
281
+ }
282
+ }
283
+
284
+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
285
+ repositories {
286
+ // Add repositories to publish to here.
287
+ // Notice: This block does NOT have the same function as the block in the top level.
288
+ // The repositories here will be used for publishing your artifact, not for
289
+ // retrieving dependencies.
290
+ }
291
+ }
292
+ compileKotlin {
293
+ kotlinOptions {
294
+ jvmTarget = "21"
295
+ }
296
+ }
297
+ compileTestKotlin {
298
+ kotlinOptions {
299
+ jvmTarget = "21"
300
+ }
301
+ }
302
+
303
+ tasks.named('clean') {
304
+ doLast {
305
+ delete "CMakeFiles", "MakeFile", "CMakeCache.txt", "cmake_install.cmake", "libnative-lib.so", "libnative-lib.dylib", "native-lib.dll"
306
+ }
307
+ }
@@ -0,0 +1,6 @@
1
+ #Sun Aug 18 14:00:31 KST 2024
2
+ distributionBase=GRADLE_USER_HOME
3
+ distributionPath=wrapper/dists
4
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
5
+ zipStoreBase=GRADLE_USER_HOME
6
+ zipStorePath=wrapper/dists
@@ -0,0 +1,19 @@
1
+ # Done to increase the memory available to gradle.
2
+ org.gradle.jvmargs=-Xmx1G
3
+
4
+ # kotlin code style
5
+ kotlin.code.style=official
6
+
7
+ # Fabric Properties
8
+ minecraft_version=1.21
9
+ yarn_mappings=1.21+build.9
10
+ loader_version=0.15.11
11
+
12
+ # Mod Properties
13
+ mod_version = 1.0-SNAPSHOT
14
+ maven_group = com.yhs0602
15
+ archives_base_name = craftground
16
+
17
+ # Dependencies
18
+ # check this on https://modmuss50.me/fabric.html
19
+ fabric_version=0.100.6+1.21
@@ -0,0 +1,186 @@
1
+ #!/usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ ##
21
+ ## Gradle start up script for UN*X
22
+ ##
23
+ ##############################################################################
24
+
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG="$0"
28
+ # Need this for relative symlinks.
29
+ while [ -h "$PRG" ] ; do
30
+ ls=`ls -ld "$PRG"`
31
+ link=`expr "$ls" : '.*-> \(.*\)$'`
32
+ if expr "$link" : '/.*' > /dev/null; then
33
+ PRG="$link"
34
+ else
35
+ PRG=`dirname "$PRG"`"/$link"
36
+ fi
37
+ done
38
+ SAVED="`pwd`"
39
+ cd "`dirname \"$PRG\"`/" >/dev/null
40
+ APP_HOME="`pwd -P`"
41
+ cd "$SAVED" >/dev/null
42
+
43
+ APP_NAME="Gradle"
44
+ APP_BASE_NAME=`basename "$0"`
45
+
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
50
+ MAX_FD="maximum"
51
+
52
+ warn () {
53
+ echo "$*"
54
+ }
55
+
56
+ die () {
57
+ echo
58
+ echo "$*"
59
+ echo
60
+ exit 1
61
+ }
62
+
63
+ # OS specific support (must be 'true' or 'false').
64
+ cygwin=false
65
+ msys=false
66
+ darwin=false
67
+ nonstop=false
68
+ case "`uname`" in
69
+ CYGWIN* )
70
+ cygwin=true
71
+ ;;
72
+ Darwin* )
73
+ darwin=true
74
+ ;;
75
+ MINGW* )
76
+ msys=true
77
+ ;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
81
+ esac
82
+
83
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+
86
+ # Determine the Java command to use to start the JVM.
87
+ if [ -n "$JAVA_HOME" ] ; then
88
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
+ # IBM's JDK on AIX uses strange locations for the executables
90
+ JAVACMD="$JAVA_HOME/jre/sh/java"
91
+ else
92
+ JAVACMD="$JAVA_HOME/bin/java"
93
+ fi
94
+ if [ ! -x "$JAVACMD" ] ; then
95
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
+
97
+ Please set the JAVA_HOME variable in your environment to match the
98
+ location of your Java installation."
99
+ fi
100
+ else
101
+ JAVACMD="java"
102
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
+
104
+ Please set the JAVA_HOME variable in your environment to match the
105
+ location of your Java installation."
106
+ fi
107
+
108
+ # Increase the maximum file descriptors if we can.
109
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
+ MAX_FD_LIMIT=`ulimit -H -n`
111
+ if [ $? -eq 0 ] ; then
112
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
+ MAX_FD="$MAX_FD_LIMIT"
114
+ fi
115
+ ulimit -n $MAX_FD
116
+ if [ $? -ne 0 ] ; then
117
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118
+ fi
119
+ else
120
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
+ fi
122
+ fi
123
+
124
+ # For Darwin, add options to specify how the application appears in the dock
125
+ if $darwin; then
126
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
+ fi
128
+
129
+ # For Cygwin or MSYS, switch paths to Windows format before running java
130
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
+
134
+ JAVACMD=`cygpath --unix "$JAVACMD"`
135
+
136
+ # We build the pattern for arguments to be converted via cygpath
137
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
+ SEP=""
139
+ for dir in $ROOTDIRSRAW ; do
140
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141
+ SEP="|"
142
+ done
143
+ OURCYGPATTERN="(^($ROOTDIRS))"
144
+ # Add a user-defined pattern to the cygpath arguments
145
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
+ fi
148
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
+ i=0
150
+ for arg in "$@" ; do
151
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
+
154
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
+ else
157
+ eval `echo args$i`="\"$arg\""
158
+ fi
159
+ i=`expr $i + 1`
160
+ done
161
+ case $i in
162
+ 0) set -- ;;
163
+ 1) set -- "$args0" ;;
164
+ 2) set -- "$args0" "$args1" ;;
165
+ 3) set -- "$args0" "$args1" "$args2" ;;
166
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
+ esac
173
+ fi
174
+
175
+ # Escape application args
176
+ save () {
177
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
+ echo " "
179
+ }
180
+ APP_ARGS=`save "$@"`
181
+
182
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
183
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
+
185
+ exec "$JAVACMD" "$@"
186
+