diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ba30f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +.gradle +.gradlew/ +run +run/ +run/* +build/ +.idea + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* diff --git a/instance/.fabric/remappedJars/minecraft-1.21-0.15.11/zipfstmp11511704576389319858.tmp b/instance/.fabric/remappedJars/minecraft-1.21-0.15.11/zipfstmp11511704576389319858.tmp new file mode 100644 index 0000000..fda5dc3 Binary files /dev/null and b/instance/.fabric/remappedJars/minecraft-1.21-0.15.11/zipfstmp11511704576389319858.tmp differ diff --git a/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-1.bcr b/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-1.bcr new file mode 100644 index 0000000..3cbb97f Binary files /dev/null and b/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-1.bcr differ diff --git a/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-2.bcr b/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-2.bcr new file mode 100644 index 0000000..91c1fbd Binary files /dev/null and b/instance/baritone/localhost/minecraft/overworld_384/cache/r.-1.-2.bcr differ diff --git a/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-1.bcr b/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-1.bcr new file mode 100644 index 0000000..5cda9ea Binary files /dev/null and b/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-1.bcr differ diff --git a/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-2.bcr b/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-2.bcr new file mode 100644 index 0000000..65de52b Binary files /dev/null and b/instance/baritone/localhost/minecraft/overworld_384/cache/r.0.-2.bcr differ diff --git a/instance/baritone/localhost/minecraft/overworld_384/waypoints/death.mp4 b/instance/baritone/localhost/minecraft/overworld_384/waypoints/death.mp4 new file mode 100644 index 0000000..97cb318 Binary files /dev/null and b/instance/baritone/localhost/minecraft/overworld_384/waypoints/death.mp4 differ diff --git a/instance/baritone/readme.txt b/instance/baritone/readme.txt new file mode 100644 index 0000000..1cdc31a --- /dev/null +++ b/instance/baritone/readme.txt @@ -0,0 +1 @@ +https://github.com/cabaletta/baritone diff --git a/instance/crash-reports/crash-2024-07-22_13.44.42-client.txt b/instance/crash-reports/crash-2024-07-22_13.44.42-client.txt new file mode 100644 index 0000000..18663d2 --- /dev/null +++ b/instance/crash-reports/crash-2024-07-22_13.44.42-client.txt @@ -0,0 +1,128 @@ +---- Minecraft Crash Report ---- +// Would you like a cupcake? + +Time: 2024-07-22 13:44:42 +Description: Initializing game + +java.lang.ExceptionInInitializerError + at net.minecraft.client.font.TextRenderLayerSet.of(TextRenderLayerSet.java:22) + at net.minecraft.client.font.FontStorage.getGlyphRenderer(FontStorage.java:176) + at net.minecraft.client.font.BuiltinEmptyGlyph.bake(BuiltinEmptyGlyph.java:53) + at net.minecraft.client.font.FontStorage.clear(FontStorage.java:65) + at net.minecraft.client.font.FontStorage.setActiveFilters(FontStorage.java:54) + at net.minecraft.client.font.FontStorage.setFonts(FontStorage.java:49) + at net.minecraft.client.font.FontManager.method_27540(FontManager.java:66) + at net.minecraft.util.Util.make(Util.java:537) + at net.minecraft.client.font.FontManager.(FontManager.java:66) + at net.minecraft.client.MinecraftClient.(MinecraftClient.java:558) + at net.minecraft.client.main.Main.main(Main.java:239) + at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) + at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) + at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) + at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) +Caused by: java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /home/astatin3/GitHub/no-more-render/run/.fabric/processedMods/meteor-client-0.5.8-2136-64b5720b4b825f21.jar + at net.fabricmc.loader.impl.util.LoaderUtil.normalizeExistingPath(LoaderUtil.java:46) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getCodeSource(KnotClassDelegate.java:515) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getMetadata(KnotClassDelegate.java:363) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:338) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) + at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) + at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) + at java.base/java.lang.ClassLoader.defineClass1(Native Method) + at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1023) + at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) + at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.defineClassFwd(KnotClassLoader.java:160) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:355) + at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) + at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) + at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) + at net.minecraft.client.render.RenderLayer.getClouds(RenderLayer.java:724) + at net.minecraft.client.render.RenderLayer.(RenderLayer.java:719) + ... 15 more +Caused by: java.nio.file.NoSuchFileException: /home/astatin3/GitHub/no-more-render/run/.fabric/processedMods/meteor-client-0.5.8-2136-64b5720b4b825f21.jar + at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) + at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) + at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) + at java.base/sun.nio.fs.UnixPath.toRealPath(UnixPath.java:886) + at net.fabricmc.loader.impl.util.LoaderUtil.normalizeExistingPath(LoaderUtil.java:44) + ... 31 more + + +A detailed walkthrough of the error, its code path and all known details is as follows: +--------------------------------------------------------------------------------------- + +-- Head -- +Thread: Render thread +Stacktrace: + at net.minecraft.client.font.TextRenderLayerSet.of(TextRenderLayerSet.java:22) + at net.minecraft.client.font.FontStorage.getGlyphRenderer(FontStorage.java:176) + at net.minecraft.client.font.BuiltinEmptyGlyph.bake(BuiltinEmptyGlyph.java:53) + at net.minecraft.client.font.FontStorage.clear(FontStorage.java:65) + at net.minecraft.client.font.FontStorage.setActiveFilters(FontStorage.java:54) + at net.minecraft.client.font.FontStorage.setFonts(FontStorage.java:49) + at net.minecraft.client.font.FontManager.method_27540(FontManager.java:66) + at net.minecraft.util.Util.make(Util.java:537) + at net.minecraft.client.font.FontManager.(FontManager.java:66) + at net.minecraft.client.MinecraftClient.(MinecraftClient.java:558) + +-- Initialization -- +Details: + Modules: +Stacktrace: + at net.minecraft.client.main.Main.main(Main.java:239) + at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) + at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) + at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) + at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) + +-- System Details -- +Details: + Minecraft Version: 1.21 + Minecraft Version ID: 1.21 + Operating System: Linux (amd64) version 6.8.9-arch1-2 + Java Version: 22, N/A + Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Oracle Corporation + Memory: 303479936 bytes (289 MiB) / 937426944 bytes (894 MiB) up to 4173332480 bytes (3980 MiB) + CPUs: 12 + Processor Vendor: GenuineIntel + Processor Name: Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz + Identifier: Intel64 Family 6 Model 165 Stepping 5 + Microarchitecture: Comet Lake + Frequency (GHz): 4.10 + Number of physical packages: 1 + Number of physical CPUs: 6 + Number of logical CPUs: 12 + Graphics card #0 name: GA104 [GeForce RTX 3070] + Graphics card #0 vendor: NVIDIA Corporation (0x10de) + Graphics card #0 VRAM (MiB): 288.00 + Graphics card #0 deviceId: 0x2484 + Graphics card #0 versionInfo: unknown + Virtual memory max (MiB): 12052.49 + Virtual memory used (MiB): 17154.10 + Swap memory total (MiB): 4096.00 + Swap memory used (MiB): 3197.18 + Space in storage for jna.tmpdir (MiB): + Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): + Space in storage for io.netty.native.workdir (MiB): + Space in storage for java.io.tmpdir (MiB): available: 7841.08, total: 7956.49 + Space in storage for workdir (MiB): available: 333892.63, total: 467346.75 + JVM Flags: 0 total; + Launched Version: Fabric + Backend library: LWJGL version 3.3.3-snapshot + Backend API: NV174 GL version 4.3 (Core Profile) Mesa 24.0.7-arch1.3, Mesa + Window size: + GFLW Platform: x11 + GL Caps: Using framebuffer using OpenGL 3.2 + GL debug messages: + Is Modded: Definitely; Client brand changed to 'fabric' + Universe: 404 + Type: Client (map_client.txt) + Locale: en_US + System encoding: UTF-8 + File encoding: UTF-8 + CPU: 12x Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz + +-- Meteor Client -- + +Version: 0.5.8 +Dev Build: 2136 diff --git a/instance/data/fabricDefaultResourcePacks.dat b/instance/data/fabricDefaultResourcePacks.dat new file mode 100644 index 0000000..7a98582 Binary files /dev/null and b/instance/data/fabricDefaultResourcePacks.dat differ diff --git a/instance/downloads/log.json b/instance/downloads/log.json new file mode 100644 index 0000000..e69de29 diff --git a/instance/logs/2024-07-11-1.log.gz b/instance/logs/2024-07-11-1.log.gz new file mode 100644 index 0000000..d6df47f Binary files /dev/null and b/instance/logs/2024-07-11-1.log.gz differ diff --git a/instance/logs/2024-07-22-1.log.gz b/instance/logs/2024-07-22-1.log.gz new file mode 100644 index 0000000..530a7ad Binary files /dev/null and b/instance/logs/2024-07-22-1.log.gz differ diff --git a/instance/logs/2024-07-22-2.log.gz b/instance/logs/2024-07-22-2.log.gz new file mode 100644 index 0000000..7e5c7a8 Binary files /dev/null and b/instance/logs/2024-07-22-2.log.gz differ diff --git a/instance/logs/2024-07-22-3.log.gz b/instance/logs/2024-07-22-3.log.gz new file mode 100644 index 0000000..b08c5f1 Binary files /dev/null and b/instance/logs/2024-07-22-3.log.gz differ diff --git a/instance/logs/2024-07-22-4.log.gz b/instance/logs/2024-07-22-4.log.gz new file mode 100644 index 0000000..43cd5d2 Binary files /dev/null and b/instance/logs/2024-07-22-4.log.gz differ diff --git a/instance/logs/2024-07-22-5.log.gz b/instance/logs/2024-07-22-5.log.gz new file mode 100644 index 0000000..7983db5 Binary files /dev/null and b/instance/logs/2024-07-22-5.log.gz differ diff --git a/instance/logs/2024-07-22-6.log.gz b/instance/logs/2024-07-22-6.log.gz new file mode 100644 index 0000000..4da4128 Binary files /dev/null and b/instance/logs/2024-07-22-6.log.gz differ diff --git a/instance/logs/2024-07-22-7.log.gz b/instance/logs/2024-07-22-7.log.gz new file mode 100644 index 0000000..8a6ac10 Binary files /dev/null and b/instance/logs/2024-07-22-7.log.gz differ diff --git a/instance/logs/debug-1.log.gz b/instance/logs/debug-1.log.gz new file mode 100644 index 0000000..5966354 Binary files /dev/null and b/instance/logs/debug-1.log.gz differ diff --git a/instance/logs/debug-2.log.gz b/instance/logs/debug-2.log.gz new file mode 100644 index 0000000..636d25e Binary files /dev/null and b/instance/logs/debug-2.log.gz differ diff --git a/instance/logs/debug-3.log.gz b/instance/logs/debug-3.log.gz new file mode 100644 index 0000000..0afa7a5 Binary files /dev/null and b/instance/logs/debug-3.log.gz differ diff --git a/instance/logs/debug-4.log.gz b/instance/logs/debug-4.log.gz new file mode 100644 index 0000000..0c17d7c Binary files /dev/null and b/instance/logs/debug-4.log.gz differ diff --git a/instance/logs/debug-5.log.gz b/instance/logs/debug-5.log.gz new file mode 100644 index 0000000..fa695cb Binary files /dev/null and b/instance/logs/debug-5.log.gz differ diff --git a/instance/meteor-client/accounts.nbt b/instance/meteor-client/accounts.nbt new file mode 100644 index 0000000..0e7ac06 Binary files /dev/null and b/instance/meteor-client/accounts.nbt differ diff --git a/instance/meteor-client/config.nbt b/instance/meteor-client/config.nbt new file mode 100644 index 0000000..e5793f0 Binary files /dev/null and b/instance/meteor-client/config.nbt differ diff --git a/instance/meteor-client/friends.nbt b/instance/meteor-client/friends.nbt new file mode 100644 index 0000000..297fa06 Binary files /dev/null and b/instance/meteor-client/friends.nbt differ diff --git a/instance/meteor-client/gui/gui.nbt b/instance/meteor-client/gui/gui.nbt new file mode 100644 index 0000000..7a2a6f8 Binary files /dev/null and b/instance/meteor-client/gui/gui.nbt differ diff --git a/instance/meteor-client/gui/themes/Meteor.nbt b/instance/meteor-client/gui/themes/Meteor.nbt new file mode 100644 index 0000000..2cd7440 Binary files /dev/null and b/instance/meteor-client/gui/themes/Meteor.nbt differ diff --git a/instance/meteor-client/hud.nbt b/instance/meteor-client/hud.nbt new file mode 100644 index 0000000..d538a58 Binary files /dev/null and b/instance/meteor-client/hud.nbt differ diff --git a/instance/meteor-client/macros.nbt b/instance/meteor-client/macros.nbt new file mode 100644 index 0000000..0817f01 Binary files /dev/null and b/instance/meteor-client/macros.nbt differ diff --git a/instance/meteor-client/modules.nbt b/instance/meteor-client/modules.nbt new file mode 100644 index 0000000..c1650bb Binary files /dev/null and b/instance/meteor-client/modules.nbt differ diff --git a/instance/meteor-client/profiles/profiles.nbt b/instance/meteor-client/profiles/profiles.nbt new file mode 100644 index 0000000..ed5a880 Binary files /dev/null and b/instance/meteor-client/profiles/profiles.nbt differ diff --git a/instance/meteor-client/proxies.nbt b/instance/meteor-client/proxies.nbt new file mode 100644 index 0000000..9ec492b Binary files /dev/null and b/instance/meteor-client/proxies.nbt differ diff --git a/instance/meteor-client/waypoints/icons/circle.png b/instance/meteor-client/waypoints/icons/circle.png new file mode 100644 index 0000000..87706d2 Binary files /dev/null and b/instance/meteor-client/waypoints/icons/circle.png differ diff --git a/instance/meteor-client/waypoints/icons/diamond.png b/instance/meteor-client/waypoints/icons/diamond.png new file mode 100644 index 0000000..1205d16 Binary files /dev/null and b/instance/meteor-client/waypoints/icons/diamond.png differ diff --git a/instance/meteor-client/waypoints/icons/skull.png b/instance/meteor-client/waypoints/icons/skull.png new file mode 100644 index 0000000..9cee727 Binary files /dev/null and b/instance/meteor-client/waypoints/icons/skull.png differ diff --git a/instance/meteor-client/waypoints/icons/square.png b/instance/meteor-client/waypoints/icons/square.png new file mode 100644 index 0000000..059c414 Binary files /dev/null and b/instance/meteor-client/waypoints/icons/square.png differ diff --git a/instance/meteor-client/waypoints/icons/star.png b/instance/meteor-client/waypoints/icons/star.png new file mode 100644 index 0000000..ee9444b Binary files /dev/null and b/instance/meteor-client/waypoints/icons/star.png differ diff --git a/instance/meteor-client/waypoints/icons/triangle.png b/instance/meteor-client/waypoints/icons/triangle.png new file mode 100644 index 0000000..46d6713 Binary files /dev/null and b/instance/meteor-client/waypoints/icons/triangle.png differ diff --git a/instance/meteor-client/waypoints/localhost.nbt b/instance/meteor-client/waypoints/localhost.nbt new file mode 100644 index 0000000..b8dd849 Binary files /dev/null and b/instance/meteor-client/waypoints/localhost.nbt differ diff --git a/instance/mods/nomorerender-1.0.2.jar~ b/instance/mods/nomorerender-1.0.2.jar~ new file mode 100644 index 0000000..39dc310 Binary files /dev/null and b/instance/mods/nomorerender-1.0.2.jar~ differ diff --git a/instance/options.txt b/instance/options.txt new file mode 100644 index 0000000..6587c7c --- /dev/null +++ b/instance/options.txt @@ -0,0 +1,142 @@ +version:3953 +ao:false +biomeBlendRadius:0 +enableVsync:false +entityDistanceScaling:1.0 +entityShadows:true +forceUnicodeFont:false +japaneseGlyphVariants:false +fov:0.0 +fovEffectScale:1.0 +darknessEffectScale:1.0 +glintSpeed:0.5 +glintStrength:0.75 +prioritizeChunkUpdates:1 +fullscreen:false +gamma:0.5 +graphicsMode:0 +guiScale:0 +maxFps:10 +mipmapLevels:4 +narrator:0 +particles:2 +reducedDebugInfo:false +renderClouds:"false" +renderDistance:12 +simulationDistance:12 +screenEffectScale:1.0 +soundDevice:"" +autoJump:false +operatorItemsTab:false +autoSuggestions:true +chatColors:true +chatLinks:true +chatLinksPrompt:true +discrete_mouse_scroll:false +invertYMouse:false +realmsNotifications:true +showSubtitles:false +directionalAudio:false +touchscreen:false +bobView:true +toggleCrouch:false +toggleSprint:false +darkMojangStudiosBackground:false +hideLightningFlashes:false +hideSplashTexts:false +mouseSensitivity:0.5 +damageTiltStrength:1.0 +highContrast:false +narratorHotkey:true +resourcePacks:["vanilla","fabric"] +incompatibleResourcePacks:[] +lastServer:localhost +lang:en_us +chatVisibility:0 +chatOpacity:1.0 +chatLineSpacing:0.0 +textBackgroundOpacity:0.5 +backgroundForChatOnly:true +hideServerAddress:false +advancedItemTooltips:false +pauseOnLostFocus:true +overrideWidth:0 +overrideHeight:0 +chatHeightFocused:1.0 +chatDelay:0.0 +chatHeightUnfocused:0.4375 +chatScale:1.0 +chatWidth:1.0 +notificationDisplayTime:1.0 +useNativeTransport:true +mainHand:"right" +attackIndicator:1 +tutorialStep:open_inventory +mouseWheelSensitivity:1.0 +rawMouseInput:true +glDebugVerbosity:1 +skipMultiplayerWarning:true +hideMatchedNames:true +joinedFirstServer:true +hideBundleTutorial:false +syncChunkWrites:false +showAutosaveIndicator:true +allowServerListing:true +onlyShowSecureChat:false +panoramaScrollSpeed:1.0 +telemetryOptInExtra:false +onboardAccessibility:false +menuBackgroundBlurriness:5 +key_key.attack:key.mouse.left +key_key.use:key.mouse.right +key_key.forward:key.keyboard.w +key_key.left:key.keyboard.a +key_key.back:key.keyboard.s +key_key.right:key.keyboard.d +key_key.jump:key.keyboard.space +key_key.sneak:key.keyboard.left.shift +key_key.sprint:key.keyboard.left.control +key_key.drop:key.keyboard.q +key_key.inventory:key.keyboard.e +key_key.chat:key.keyboard.t +key_key.playerlist:key.keyboard.tab +key_key.pickItem:key.mouse.middle +key_key.command:key.keyboard.slash +key_key.socialInteractions:key.keyboard.p +key_key.screenshot:key.keyboard.f2 +key_key.togglePerspective:key.keyboard.f5 +key_key.smoothCamera:key.keyboard.unknown +key_key.fullscreen:key.keyboard.f11 +key_key.spectatorOutlines:key.keyboard.unknown +key_key.swapOffhand:key.keyboard.f +key_key.saveToolbarActivator:key.keyboard.c +key_key.loadToolbarActivator:key.keyboard.x +key_key.advancements:key.keyboard.l +key_key.hotbar.1:key.keyboard.1 +key_key.hotbar.2:key.keyboard.2 +key_key.hotbar.3:key.keyboard.3 +key_key.hotbar.4:key.keyboard.4 +key_key.hotbar.5:key.keyboard.5 +key_key.hotbar.6:key.keyboard.6 +key_key.hotbar.7:key.keyboard.7 +key_key.hotbar.8:key.keyboard.8 +key_key.hotbar.9:key.keyboard.9 +key_key.meteor-client.open-gui:key.keyboard.right.shift +key_key.meteor-client.open-commands:key.keyboard.period +soundCategory_master:1.0 +soundCategory_music:1.0 +soundCategory_record:1.0 +soundCategory_weather:1.0 +soundCategory_block:1.0 +soundCategory_hostile:1.0 +soundCategory_neutral:1.0 +soundCategory_player:1.0 +soundCategory_ambient:1.0 +soundCategory_voice:1.0 +modelPart_cape:true +modelPart_jacket:true +modelPart_left_sleeve:true +modelPart_right_sleeve:true +modelPart_left_pants_leg:true +modelPart_right_pants_leg:true +modelPart_hat:true diff --git a/instance/servers.dat b/instance/servers.dat new file mode 100644 index 0000000..e1ce90c Binary files /dev/null and b/instance/servers.dat differ diff --git a/instance/servers.dat_old b/instance/servers.dat_old new file mode 100644 index 0000000..e1ce90c Binary files /dev/null and b/instance/servers.dat_old differ diff --git a/meteoraddon-old/.editorconfig b/meteoraddon-old/.editorconfig new file mode 100644 index 0000000..b722415 --- /dev/null +++ b/meteoraddon-old/.editorconfig @@ -0,0 +1,12 @@ +[*] +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +indent_size = 4 + +[*.{json, yml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/meteoraddon-old/.github/workflows/dev_build.yml b/meteoraddon-old/.github/workflows/dev_build.yml new file mode 100644 index 0000000..672d502 --- /dev/null +++ b/meteoraddon-old/.github/workflows/dev_build.yml @@ -0,0 +1,23 @@ +name: Publish Development Build +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: adopt + - name: Build + run: ./gradlew build + - name: Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: '${{ secrets.GITHUB_TOKEN }}' + automatic_release_tag: latest + prerelease: true + title: Dev Build + files: | + ./build/libs/*.jar diff --git a/meteoraddon-old/.github/workflows/pull_request.yml b/meteoraddon-old/.github/workflows/pull_request.yml new file mode 100644 index 0000000..e60e76d --- /dev/null +++ b/meteoraddon-old/.github/workflows/pull_request.yml @@ -0,0 +1,19 @@ +name: Build Pull Request +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: adopt + - name: Build + run: ./gradlew build + - name: Upload artifacts + uses: actions/upload-artifact@v2.2.4 + with: + name: build-artifacts + path: build/libs diff --git a/meteoraddon-old/.gitignore b/meteoraddon-old/.gitignore new file mode 100644 index 0000000..09cd281 --- /dev/null +++ b/meteoraddon-old/.gitignore @@ -0,0 +1,33 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ diff --git a/meteoraddon-old/README.md b/meteoraddon-old/README.md new file mode 100644 index 0000000..90b04e9 --- /dev/null +++ b/meteoraddon-old/README.md @@ -0,0 +1,8 @@ +# Meteor Addon Template + +A template to allow easy usage of the Meteor Addon API. + +### How to use: +- Clone this project +- Use this template to create new modules/commands +- Run the mod with Meteor. \ No newline at end of file diff --git a/meteoraddon-old/build.gradle b/meteoraddon-old/build.gradle new file mode 100644 index 0000000..c634c66 --- /dev/null +++ b/meteoraddon-old/build.gradle @@ -0,0 +1,53 @@ +plugins { + id "fabric-loom" version "1.6-SNAPSHOT" + id "java" +} + +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 + +archivesBaseName = project.archives_base_name +version = project.mod_version +group = project.maven_group + +repositories { + maven { + name = "Meteor Dev Releases" + url = "https://maven.meteordev.org/releases" + } + maven { + name = "Meteor Dev Snapshots" + url = "https://maven.meteordev.org/snapshots" + } + mavenCentral() + maven { + url "https://jitpack.io" + } + maven { + url "https://alwyn974.github.io/maven" + } + maven { + url "https://repo.opencollab.dev/maven-releases/" + } +} + +dependencies { + // Fabric + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Meteor + modImplementation "meteordevelopment:meteor-client:${project.meteor_version}" + + // MeteorBot +} + +processResources { + filesMatching("fabric.mod.json") { + expand "version": project.version, "mc_version": project.minecraft_version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding("UTF-8") +} diff --git a/meteoraddon-old/gradle.properties b/meteoraddon-old/gradle.properties new file mode 100644 index 0000000..1438b6a --- /dev/null +++ b/meteoraddon-old/gradle.properties @@ -0,0 +1,16 @@ +org.gradle.jvmargs=-Xmx2G + +# Fabric Properties (https://fabricmc.net/develop) +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.2 +loader_version=0.15.1 + +# Mod Properties +mod_version=0.1.0 +maven_group=com.example +archives_base_name=addon-template + +# Dependencies + +# Meteor (https://maven.meteordev.org) +meteor_version=0.5.6-SNAPSHOT diff --git a/meteoraddon-old/gradle/wrapper/gradle-wrapper.properties b/meteoraddon-old/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..509c4a2 --- /dev/null +++ b/meteoraddon-old/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/meteoraddon-old/gradlew b/meteoraddon-old/gradlew new file mode 100755 index 0000000..65dcd68 --- /dev/null +++ b/meteoraddon-old/gradlew @@ -0,0 +1,244 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/meteoraddon-old/gradlew.bat b/meteoraddon-old/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/meteoraddon-old/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/meteoraddon-old/settings.gradle b/meteoraddon-old/settings.gradle new file mode 100644 index 0000000..b02216b --- /dev/null +++ b/meteoraddon-old/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} diff --git a/meteoraddon-old/src/main/java/com/astatin3/meteorbot/Addon.java b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/Addon.java new file mode 100644 index 0000000..40d3caf --- /dev/null +++ b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/Addon.java @@ -0,0 +1,44 @@ +package com.astatin3.meteorbot; + +import com.astatin3.meteorbot.commands.CommandExample; +import com.astatin3.meteorbot.hud.HudExample; +import com.astatin3.meteorbot.modules.ModuleExample; +import com.mojang.logging.LogUtils; +import meteordevelopment.meteorclient.addons.MeteorAddon; +import meteordevelopment.meteorclient.commands.Commands; +import meteordevelopment.meteorclient.systems.hud.Hud; +import meteordevelopment.meteorclient.systems.hud.HudGroup; +import meteordevelopment.meteorclient.systems.modules.Category; +import meteordevelopment.meteorclient.systems.modules.Modules; +import org.slf4j.Logger; + +public class Addon extends MeteorAddon { + public static final Logger LOG = LogUtils.getLogger(); + public static final Category CATEGORY = new Category("MeteorBot"); + public static final HudGroup HUD_GROUP = new HudGroup("MeteorBot"); + + @Override + public void onInitialize() { +// LOG.info("Initializing Meteor Addon Template"); + + // Modules + ModuleExample module = new ModuleExample(); + Modules.get().add(module); + + // Commands + Commands.add(new CommandExample(module)); + + // HUD + Hud.get().register(HudExample.INFO); + } + + @Override + public void onRegisterCategories() { + Modules.registerCategory(CATEGORY); + } + + @Override + public String getPackage() { + return "com.astatin3.meteorbot"; + } +} diff --git a/meteoraddon-old/src/main/java/com/astatin3/meteorbot/commands/CommandExample.java b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/commands/CommandExample.java new file mode 100644 index 0000000..e5be077 --- /dev/null +++ b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/commands/CommandExample.java @@ -0,0 +1,123 @@ +package com.astatin3.meteorbot.commands; + +import com.astatin3.meteorbot.modules.ModuleExample; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class CommandExample extends Command { + private ModuleExample module; + + public CommandExample(ModuleExample module) { + super("mb", "Sends a message."); + this.module = module; + } + + private void printHelpInfo(){ +// info("\n" + +// "-- Meteor Bot Help --\n" + +// "\n" + +// ".mb help - Print this help info\n" + +// ".mb chat - Send chat message\n" + +// ".mb cmd - Send command (No '/')\n" + +// ".mb goto - Go to xyz choord\n" + +// ".mb follow - Follow player\n" + +// ".mb stop - Stop current action\n" + +// ".mb rawsend - Send raw message to bot\n" + +// ".mb quit - Make bot leave the game"); + info("\n" + + "-- Meteor Bot Help --\n" + + "\n" + + ".mb help - Print this help info\n" + + ".mb cmd - Send cmd"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.executes(context -> { + printHelpInfo(); + return SINGLE_SUCCESS; + }); + + builder.then(literal("help").executes(context -> { + printHelpInfo(); + return SINGLE_SUCCESS; + })); + + builder.then(literal("chat") + .then( + argument( + "msg", StringArgumentType.greedyString()) + .executes(context -> { +// module.writeSTDIN("chat:" + context.getArgument("msg", String.class)); + return SINGLE_SUCCESS; + }))); + + builder.then(literal("cmd") + .then( + argument( + "cmd", StringArgumentType.greedyString()) + .executes(context -> { +// module.writeSTDIN("cmd:" + context.getArgument("cmd", String.class)); + return SINGLE_SUCCESS; + }))); + + + builder.then(literal("stop").executes(context -> { +// module.writeSTDIN("Stop"); +// if(module.followMode){ +// module.followMode = false; +// } + return SINGLE_SUCCESS; + })); + + + builder.then(literal("quit").executes(context -> { +// module.quitBot(); + return SINGLE_SUCCESS; + })); + + + builder.then(literal("goto") + .then( + argument( + "x", IntegerArgumentType.integer()) + .then( + argument( + "y", IntegerArgumentType.integer()) + .then( + argument( + "z", IntegerArgumentType.integer()) + .executes(context -> { + +// module.writeSTDIN( +// "goto:" + context.getArgument("x", Integer.class) + "," + +// context.getArgument("y", Integer.class) + "," + +// context.getArgument("z", Integer.class)); + return SINGLE_SUCCESS; + }))))); + + builder.then(literal("rawsend") + .then( + argument( + "type", StringArgumentType.string()) + .then( + argument( + "content", StringArgumentType.greedyString()) + .executes(context -> { +// module.writeSTDIN(context.getArgument("type", String.class) + ":" + context.getArgument("content", String.class)); + return SINGLE_SUCCESS; + })))); + + builder.then(literal("follow") + .executes(context -> { +// module.startFollowMode(); + return SINGLE_SUCCESS; + })); + + } +} diff --git a/meteoraddon-old/src/main/java/com/astatin3/meteorbot/hud/HudExample.java b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/hud/HudExample.java new file mode 100644 index 0000000..604a9f6 --- /dev/null +++ b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/hud/HudExample.java @@ -0,0 +1,22 @@ +package com.astatin3.meteorbot.hud; + +import com.astatin3.meteorbot.Addon; +import meteordevelopment.meteorclient.systems.hud.HudElement; +import meteordevelopment.meteorclient.systems.hud.HudElementInfo; +import meteordevelopment.meteorclient.systems.hud.HudRenderer; +import meteordevelopment.meteorclient.utils.render.color.Color; + +public class HudExample extends HudElement { + public static final HudElementInfo INFO = new HudElementInfo<>(Addon.HUD_GROUP, "example", "HUD element example.", HudExample::new); + + public HudExample() { + super(INFO); + } + + @Override + public void render(HudRenderer renderer) { + setSize(renderer.textWidth("Example element", true), renderer.textHeight(true)); + + renderer.text("Example element", x, y, Color.WHITE, true); + } +} diff --git a/meteoraddon-old/src/main/java/com/astatin3/meteorbot/modules/ModuleExample.java b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/modules/ModuleExample.java new file mode 100644 index 0000000..718f4d4 --- /dev/null +++ b/meteoraddon-old/src/main/java/com/astatin3/meteorbot/modules/ModuleExample.java @@ -0,0 +1,127 @@ +package com.astatin3.meteorbot.modules; + +import com.astatin3.meteorbot.Addon; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.settings.StringSetting; +import meteordevelopment.meteorclient.systems.modules.Module; +import net.minecraft.util.math.Vec3d; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + + +public class ModuleExample extends Module { + public ModuleExample() { + super(Addon.CATEGORY, "Meteor-Bot", "An example module in a custom category."); + } + + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting botpath = sgGeneral.add(new StringSetting.Builder() + .name("Path") + .description("The location of the bot .minecraft folder") + .defaultValue("/home/astatin3/GitHub/meteorbot/instance") + .visible(() -> true) + .build() + ); + + private final Setting verboseMode = sgGeneral.add(new BoolSetting.Builder() + .name("Verbose") + .description("Enable verbose output") + .defaultValue(true) + .visible(() -> true) + .build() + ); + + private Process process; + private BufferedOutputStream stdin; + + private Thread cmdThread = null; + + + public void startBot(){ + try { + // Set up the classpath and main class + String minecraftJar = "path/to/minecraft.jar"; + String mainClass = "net.minecraft.client.main.Main"; + + // Set up JVM arguments + List jvmArgs = new ArrayList<>(); + jvmArgs.add("java"); + jvmArgs.add("-Xmx2G"); // Adjust max heap size as needed + jvmArgs.add("-XX:+UnlockExperimentalVMOptions"); + jvmArgs.add("-XX:+UseG1GC"); + jvmArgs.add("-XX:G1NewSizePercent=20"); + jvmArgs.add("-XX:G1ReservePercent=20"); + jvmArgs.add("-XX:MaxGCPauseMillis=50"); + jvmArgs.add("-XX:G1HeapRegionSize=32M"); + jvmArgs.add("-cp"); + jvmArgs.add(minecraftJar); + jvmArgs.add(mainClass); + + // Add Minecraft arguments + jvmArgs.add("--username"); + jvmArgs.add("Player"); + jvmArgs.add("--version"); + jvmArgs.add("1.19.4"); // Adjust to your Minecraft version + jvmArgs.add("--gameDir"); + jvmArgs.add("."); + jvmArgs.add("--assetsDir"); + jvmArgs.add("assets"); + jvmArgs.add("--assetIndex"); + jvmArgs.add("1.19"); // Adjust to your asset index + jvmArgs.add("--uuid"); + jvmArgs.add(java.util.UUID.randomUUID().toString()); + jvmArgs.add("--accessToken"); + jvmArgs.add("0"); // Use a valid access token for online play + jvmArgs.add("--userType"); + jvmArgs.add("mojang"); + + // Create process builder + ProcessBuilder pb = new ProcessBuilder(jvmArgs); + pb.directory(new File(".")); + pb.inheritIO(); + + // Start the process + process = pb.start(); + + // Wait for the process to finish + int exitCode = process.waitFor(); + info("Minecraft exited with code: " + exitCode); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void startThread(){ + cmdThread = new Thread(() -> { + startBot(); + }); + cmdThread.start(); + } + + public void stopThread(){ + if(cmdThread != null) { + cmdThread.interrupt(); + cmdThread = null; + } + } + + + public void onActivate() { + startThread(); + } + + @Override + public void onDeactivate() { + stopThread(); + } + + +} + diff --git a/meteoraddon-old/src/main/resources/assets/template/icon.png b/meteoraddon-old/src/main/resources/assets/template/icon.png new file mode 100644 index 0000000..3fb2e7f Binary files /dev/null and b/meteoraddon-old/src/main/resources/assets/template/icon.png differ diff --git a/meteoraddon-old/src/main/resources/fabric.mod.json b/meteoraddon-old/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..e19a36c --- /dev/null +++ b/meteoraddon-old/src/main/resources/fabric.mod.json @@ -0,0 +1,31 @@ +{ + "schemaVersion": 1, + "id": "meteorbot", + "version": "${version}", + "name": "Meteor-Bot", + "description": "An addon template for the Meteor addons.", + "authors": [ + "seasnail" + ], + "contact": { + "repo": "https://github.com/MeteorDevelopment/meteor-addon-template" + }, + "icon": "assets/template/icon.png", + "environment": "client", + "entrypoints": { + "meteor": [ + "com.astatin3.meteorbot.Addon" + ] + }, + "mixins": [ + "meteorbot.mixins.json" + ], + "custom": { + "meteor-client:color": "225,25,25" + }, + "depends": { + "java": ">=17", + "minecraft": ">=${mc_version}", + "meteor-client": "*" + } +} diff --git a/meteoraddon-old/src/main/resources/meteorbot.mixins.json b/meteoraddon-old/src/main/resources/meteorbot.mixins.json new file mode 100644 index 0000000..93b5dde --- /dev/null +++ b/meteoraddon-old/src/main/resources/meteorbot.mixins.json @@ -0,0 +1,9 @@ +{ + "required": true, + "package": "com.example.addon.mixin", + "compatibilityLevel": "JAVA_17", + "client": [], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/meteoraddon/.editorconfig b/meteoraddon/.editorconfig new file mode 100644 index 0000000..b722415 --- /dev/null +++ b/meteoraddon/.editorconfig @@ -0,0 +1,12 @@ +[*] +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +indent_size = 4 + +[*.{json, yml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/meteoraddon/.github/workflows/dev_build.yml b/meteoraddon/.github/workflows/dev_build.yml new file mode 100644 index 0000000..f58efd0 --- /dev/null +++ b/meteoraddon/.github/workflows/dev_build.yml @@ -0,0 +1,27 @@ +name: Publish Development Build +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: adopt + - name: Build with Gradle + run: ./gradlew build + - name: Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: '${{ secrets.GITHUB_TOKEN }}' + automatic_release_tag: latest + prerelease: true + title: Dev Build + files: | + ./build/libs/*.jar diff --git a/meteoraddon/.github/workflows/pull_request.yml b/meteoraddon/.github/workflows/pull_request.yml new file mode 100644 index 0000000..e0b5026 --- /dev/null +++ b/meteoraddon/.github/workflows/pull_request.yml @@ -0,0 +1,23 @@ +name: Build Pull Request Artifacts +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: adopt + - name: Build with Gradle + run: ./gradlew build + - name: Release + uses: actions/upload-artifact@v4 + with: + name: Artifacts + path: build/libs/ diff --git a/meteoraddon/.gitignore b/meteoraddon/.gitignore new file mode 100644 index 0000000..09cd281 --- /dev/null +++ b/meteoraddon/.gitignore @@ -0,0 +1,33 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ diff --git a/meteoraddon/build.gradle b/meteoraddon/build.gradle new file mode 100644 index 0000000..33ef2ca --- /dev/null +++ b/meteoraddon/build.gradle @@ -0,0 +1,59 @@ +plugins { + id "fabric-loom" version "1.7-SNAPSHOT" +} + +base { + archivesBaseName = project.archives_base_name + version = project.mod_version + group = project.maven_group +} + +repositories { + maven { + name = "Meteor Dev Releases" + url = "https://maven.meteordev.org/releases" + } + maven { + name = "Meteor Dev Snapshots" + url = "https://maven.meteordev.org/snapshots" + } +} + +dependencies { + // Fabric + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Meteor + modImplementation "meteordevelopment:meteor-client:${project.meteor_version}" +} + +tasks { + processResources { + def propertyMap = [ + "version" : project.version, + "mc_version": project.minecraft_version, + ] + + filesMatching("fabric.mod.json") { + expand(propertyMap) + } + } + + jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesBaseName}" } + } + } + + java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + } + + tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" + it.options.release = 21 + } +} diff --git a/meteoraddon/gradle.properties b/meteoraddon/gradle.properties new file mode 100644 index 0000000..7728107 --- /dev/null +++ b/meteoraddon/gradle.properties @@ -0,0 +1,16 @@ +org.gradle.jvmargs=-Xmx2G + +# Fabric Properties (https://fabricmc.net/develop) +minecraft_version=1.21 +yarn_mappings=1.21+build.8 +loader_version=0.15.11 + +# Mod Properties +mod_version=0.1.0 +maven_group=com.example +archives_base_name=addon-template + +# Dependencies + +# Meteor (https://maven.meteordev.org) +meteor_version=0.5.8-SNAPSHOT diff --git a/meteoraddon/gradle/wrapper/gradle-wrapper.properties b/meteoraddon/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a441313 --- /dev/null +++ b/meteoraddon/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/meteoraddon/gradlew b/meteoraddon/gradlew new file mode 100755 index 0000000..65dcd68 --- /dev/null +++ b/meteoraddon/gradlew @@ -0,0 +1,244 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/meteoraddon/gradlew.bat b/meteoraddon/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/meteoraddon/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/meteoraddon/settings.gradle b/meteoraddon/settings.gradle new file mode 100644 index 0000000..b02216b --- /dev/null +++ b/meteoraddon/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/AddonTemplate.java b/meteoraddon/src/main/java/com/example/addon/AddonTemplate.java new file mode 100644 index 0000000..56c9d28 --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/AddonTemplate.java @@ -0,0 +1,52 @@ +package com.example.addon; + +import com.example.addon.commands.CommandExample; +import com.example.addon.hud.HudExample; +import com.example.addon.modules.ModuleExample; +import com.mojang.logging.LogUtils; +import meteordevelopment.meteorclient.addons.GithubRepo; +import meteordevelopment.meteorclient.addons.MeteorAddon; +import meteordevelopment.meteorclient.commands.Commands; +import meteordevelopment.meteorclient.systems.hud.Hud; +import meteordevelopment.meteorclient.systems.hud.HudGroup; +import meteordevelopment.meteorclient.systems.modules.Category; +import meteordevelopment.meteorclient.systems.modules.Modules; +import org.slf4j.Logger; + +public class AddonTemplate extends MeteorAddon { + public static final Logger LOG = LogUtils.getLogger(); + public static final Category CATEGORY = new Category("Example"); + public static final HudGroup HUD_GROUP = new HudGroup("Example"); + + @Override + public void onInitialize() { + LOG.info("Initializing Meteor Addon Template"); + + LauncherManger lm = new LauncherManger(); + + // Modules + ModuleExample m = new ModuleExample(lm); + Modules.get().add(m); + + // Commands + Commands.add(new CommandExample(lm)); + + // HUD + Hud.get().register(HudExample.INFO); + } + + @Override + public void onRegisterCategories() { + Modules.registerCategory(CATEGORY); + } + + @Override + public String getPackage() { + return "com.example.addon"; + } + + @Override + public GithubRepo getRepo() { + return new GithubRepo("MeteorDevelopment", "meteor-addon-template"); + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/LauncherManger.java b/meteoraddon/src/main/java/com/example/addon/LauncherManger.java new file mode 100644 index 0000000..f8c0c2f --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/LauncherManger.java @@ -0,0 +1,35 @@ +package com.example.addon; + +import net.minecraft.client.network.ServerAddress; + +import java.util.ArrayList; +import java.util.List; + +public class LauncherManger { + public LauncherManger(){} + + public List launcherList = null; + + public void start(String gamedir, int num, String usernamePrefix, ServerAddress address){ + launcherList = new ArrayList<>(); + for(int i = 0; i < num; i++){ + launcher l = new launcher(gamedir, usernamePrefix, i, address); + l.start(); + launcherList.add(l); + } + } + + public void stop(){ + if(launcherList == null) return; + + for(int i = 0; i < launcherList.size(); i++){ + launcherList.get(i).stop(); + } + + launcherList = null; + } + + public boolean running(){ + return launcherList != null; + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/commands/CommandExample.java b/meteoraddon/src/main/java/com/example/addon/commands/CommandExample.java new file mode 100644 index 0000000..dbe6ee7 --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/commands/CommandExample.java @@ -0,0 +1,44 @@ +package com.example.addon.commands; + +import com.example.addon.AddonTemplate; +import com.example.addon.LauncherManger; +import com.example.addon.modules.ModuleExample; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +/** + * The Meteor Client command API uses the same command system as Minecraft does. + */ +public class CommandExample extends Command { + LauncherManger lm; + public CommandExample(LauncherManger lm) { + super("bot", "Sends a message."); + this.lm = lm; + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.executes(context -> { + info("hi"); + return SINGLE_SUCCESS; + }); + + builder.then(literal("name").then(argument("nameArgument", StringArgumentType.greedyString()).executes(context -> { + String argument = StringArgumentType.getString(context, "nameArgument"); + if(!lm.running()){ + info("The bot has not been initilized yet."); + return SINGLE_SUCCESS; + } + + for(int i = 0; i < lm.launcherList.size(); i++){ + lm.launcherList.get(i).mcinput.println(argument); + } + + return SINGLE_SUCCESS; + }))); + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/hud/HudExample.java b/meteoraddon/src/main/java/com/example/addon/hud/HudExample.java new file mode 100644 index 0000000..bdf5928 --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/hud/HudExample.java @@ -0,0 +1,29 @@ +package com.example.addon.hud; + +import com.example.addon.AddonTemplate; +import meteordevelopment.meteorclient.systems.hud.HudElement; +import meteordevelopment.meteorclient.systems.hud.HudElementInfo; +import meteordevelopment.meteorclient.systems.hud.HudRenderer; +import meteordevelopment.meteorclient.utils.render.color.Color; + +public class HudExample extends HudElement { + /** + * The {@code name} parameter should be in kebab-case. + */ + public static final HudElementInfo INFO = new HudElementInfo<>(AddonTemplate.HUD_GROUP, "example", "HUD element example.", HudExample::new); + + public HudExample() { + super(INFO); + } + + @Override + public void render(HudRenderer renderer) { + setSize(renderer.textWidth("Example element", true), renderer.textHeight(true)); + + // Render background + renderer.quad(x, y, getWidth(), getHeight(), Color.LIGHT_GRAY); + + // Render text + renderer.text("Example element", x, y, Color.WHITE, true); + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/launcher.java b/meteoraddon/src/main/java/com/example/addon/launcher.java new file mode 100644 index 0000000..9dd4289 --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/launcher.java @@ -0,0 +1,233 @@ +package com.example.addon; + +import net.minecraft.client.network.ServerAddress; + +import java.io.*; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class launcher { + private static String get_classpaths(String libdir){ + return String.join(":", new String[]{ + libdir + "/org/lwjgl/lwjgl-freetype-natives-linux/3.3.3/lwjgl-freetype-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-freetype/3.3.3/lwjgl-freetype-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-glfw-natives-linux/3.3.3/lwjgl-glfw-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-glfw/3.3.3/lwjgl-glfw-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-jemalloc-natives-linux/3.3.3/lwjgl-jemalloc-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-jemalloc/3.3.3/lwjgl-jemalloc-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-natives-linux/3.3.3/lwjgl-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-openal-natives-linux/3.3.3/lwjgl-openal-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-openal/3.3.3/lwjgl-openal-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-opengl-natives-linux/3.3.3/lwjgl-opengl-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-opengl/3.3.3/lwjgl-opengl-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-stb-natives-linux/3.3.3/lwjgl-stb-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-stb/3.3.3/lwjgl-stb-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-tinyfd-natives-linux/3.3.3/lwjgl-tinyfd-natives-linux-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl-tinyfd/3.3.3/lwjgl-tinyfd-3.3.3.jar", + libdir + "/org/lwjgl/lwjgl/3.3.3/lwjgl-3.3.3.jar", + libdir + "/com/github/oshi/oshi-core/6.4.10/oshi-core-6.4.10.jar", + libdir + "/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar", + libdir + "/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar", + libdir + "/com/google/guava/guava/32.1.2-jre/guava-32.1.2-jre.jar", + libdir + "/com/ibm/icu/icu4j/73.2/icu4j-73.2.jar", + libdir + "/com/mojang/authlib/6.0.54/authlib-6.0.54.jar", + libdir + "/com/mojang/blocklist/1.0.10/blocklist-1.0.10.jar", + libdir + "/com/mojang/brigadier/1.2.9/brigadier-1.2.9.jar", + libdir + "/com/mojang/datafixerupper/8.0.16/datafixerupper-8.0.16.jar", + libdir + "/com/mojang/logging/1.2.7/logging-1.2.7.jar", + libdir + "/com/mojang/patchy/2.2.10/patchy-2.2.10.jar", + libdir + "/com/mojang/text2speech/1.17.9/text2speech-1.17.9.jar", + libdir + "/commons-codec/commons-codec/1.16.0/commons-codec-1.16.0.jar", + libdir + "/commons-io/commons-io/2.15.1/commons-io-2.15.1.jar", + libdir + "/commons-logging/commons-logging/1.2/commons-logging-1.2.jar", + libdir + "/io/netty/netty-buffer/4.1.97.Final/netty-buffer-4.1.97.Final.jar", + libdir + "/io/netty/netty-codec/4.1.97.Final/netty-codec-4.1.97.Final.jar", + libdir + "/io/netty/netty-common/4.1.97.Final/netty-common-4.1.97.Final.jar", + libdir + "/io/netty/netty-handler/4.1.97.Final/netty-handler-4.1.97.Final.jar", + libdir + "/io/netty/netty-resolver/4.1.97.Final/netty-resolver-4.1.97.Final.jar", + libdir + "/io/netty/netty-transport-classes-epoll/4.1.97.Final/netty-transport-classes-epoll-4.1.97.Final.jar", + libdir + "/io/netty/netty-transport-native-epoll/4.1.97.Final/netty-transport-native-epoll-4.1.97.Final-linux-aarch_64.jar", + libdir + "/io/netty/netty-transport-native-epoll/4.1.97.Final/netty-transport-native-epoll-4.1.97.Final-linux-x86_64.jar", + libdir + "/io/netty/netty-transport-native-unix-common/4.1.97.Final/netty-transport-native-unix-common-4.1.97.Final.jar", + libdir + "/io/netty/netty-transport/4.1.97.Final/netty-transport-4.1.97.Final.jar", + libdir + "/it/unimi/dsi/fastutil/8.5.12/fastutil-8.5.12.jar", + libdir + "/net/java/dev/jna/jna-platform/5.14.0/jna-platform-5.14.0.jar", + libdir + "/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar", + libdir + "/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar", + libdir + "/org/apache/commons/commons-compress/1.26.0/commons-compress-1.26.0.jar", + libdir + "/org/apache/commons/commons-lang3/3.14.0/commons-lang3-3.14.0.jar", + libdir + "/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar", + libdir + "/org/apache/httpcomponents/httpcore/4.4.16/httpcore-4.4.16.jar", + libdir + "/org/apache/logging/log4j/log4j-api/2.22.1/log4j-api-2.22.1.jar", + libdir + "/org/apache/logging/log4j/log4j-core/2.22.1/log4j-core-2.22.1.jar", + libdir + "/org/apache/logging/log4j/log4j-slf4j2-impl/2.22.1/log4j-slf4j2-impl-2.22.1.jar", + libdir + "/org/jcraft/jorbis/0.0.17/jorbis-0.0.17.jar", + libdir + "/org/joml/joml/1.10.5/joml-1.10.5.jar", + libdir + "/org/lz4/lz4-java/1.8.0/lz4-java-1.8.0.jar", + libdir + "/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar", + libdir + "/net/fabricmc/intermediary/1.21/intermediary-1.21.jar", + libdir + "/org/ow2/asm/asm/9.6/asm-9.6.jar", + libdir + "/org/ow2/asm/asm-analysis/9.6/asm-analysis-9.6.jar", + libdir + "/org/ow2/asm/asm-commons/9.6/asm-commons-9.6.jar", + libdir + "/org/ow2/asm/asm-tree/9.6/asm-tree-9.6.jar", + libdir + "/org/ow2/asm/asm-util/9.6/asm-util-9.6.jar", + libdir + "/net/fabricmc/sponge-mixin/0.13.3+mixin.0.8.5/sponge-mixin-0.13.3+mixin.0.8.5.jar", + libdir + "/net/fabricmc/fabric-loader/0.15.11/fabric-loader-0.15.11.jar", + libdir + "/com/mojang/minecraft/1.21/minecraft-1.21-client.jar" + }); + } + + private static List get_args(String gameDir){ + String mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient"; + + // Set up JVM arguments + List jvmArgs = new ArrayList<>(); + jvmArgs.add("java"); + jvmArgs.add("-Xmx512M"); // Adjust max heap size as needed + jvmArgs.add("-XX:+UnlockExperimentalVMOptions"); + jvmArgs.add("-XX:+UseG1GC"); + jvmArgs.add("-XX:G1NewSizePercent=20"); + jvmArgs.add("-XX:G1ReservePercent=20"); + jvmArgs.add("-XX:MaxGCPauseMillis=50"); + jvmArgs.add("-XX:G1HeapRegionSize=32M"); + jvmArgs.add("-cp"); + jvmArgs.add(get_classpaths(gameDir+"/libraries")); + jvmArgs.add("-Djava.library.path=\"" + gameDir + "/natives\""); +// jvmArgs.add(minecraftJar); + jvmArgs.add(mainClass); + + // Add Minecraft arguments + jvmArgs.add("--version"); + jvmArgs.add("1.21"); // Adjust to your Minecraft version + jvmArgs.add("--gameDir"); + jvmArgs.add(gameDir); + jvmArgs.add("--assetsDir"); + jvmArgs.add(gameDir+"/assets"); + jvmArgs.add("--assetIndex"); + jvmArgs.add("17"); // Adjust to your asset index + jvmArgs.add("--uuid"); + jvmArgs.add(java.util.UUID.randomUUID().toString()); + jvmArgs.add("--accessToken"); + jvmArgs.add("0"); // Use a valid access token for online play + jvmArgs.add("--userType"); + jvmArgs.add("mojang"); + + return jvmArgs; + } + + private int botid; + private String username; + private String gamedir; + private ServerAddress addr; + + public launcher(String gamedir, String username, int botid, ServerAddress address){ + this.gamedir = gamedir; + this.username = username; + this.botid = botid; + this.addr = address; + } + + private Process process; + + private BufferedOutputStream stdin; + + private Thread processThread = null; + private Thread socketThread = null; + + private BufferedReader mcoutput = null; + public PrintWriter mcinput; + + private void run(){ + System.out.println(addr.toString()); + + try { + List jvmArgs = get_args(gamedir); + jvmArgs.add("--username"); + jvmArgs.add(username + botid); + + System.out.println(String.join(" ", jvmArgs.toArray(new String[0]))); + + // Create process builder + ProcessBuilder pb = new ProcessBuilder(jvmArgs); + pb.directory(new File(".")); +// pb.inheritIO(); + + // Start the process + process = pb.start(); + mcoutput = new BufferedReader(new InputStreamReader(process.getInputStream())); + + String str; + while ((str = mcoutput.readLine()) != null) { + System.out.println(str); + if(str.contains("(no-more-render) Started!")) + finishInit(); + } + +// + System.out.println("Minecraft exited with code: " + process.waitFor()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void finishInit(){ + System.out.println("Started connecting ..."); + socketThread = new Thread(() -> { + while(!socketThread.isInterrupted()) { + try (Socket socket = new Socket("localhost", 65000 + botid)) { + + System.out.println("Conencted to bot " + botid + "!"); + + mcinput = new PrintWriter(socket.getOutputStream(), true); + mcinput.println("connect " + addr.getAddress() + " " + addr.getPort()); + + BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); + + String line; + while ((line = reader.readLine()) != null && !socketThread.isInterrupted()) { + System.out.println(line); + } + } catch (UnknownHostException ex) { + + System.out.println("Server not found: " + ex.getMessage()); + + } catch (IOException ex) { + + System.out.println("I/O error: " + ex.getMessage()); + } + } + }); + socketThread.start(); + } + + + + + + + + public void start(){ + processThread = new Thread(this::run); + processThread.start(); + } + + public void stop(){ + if(processThread != null) { + processThread.interrupt(); + processThread = null; + } + if(process != null){ + process.destroyForcibly(); + process = null; + } + if(socketThread != null){ + socketThread.interrupt(); + socketThread = null; + } + } +} diff --git a/meteoraddon/src/main/java/com/example/addon/modules/ModuleExample.java b/meteoraddon/src/main/java/com/example/addon/modules/ModuleExample.java new file mode 100644 index 0000000..16f73ea --- /dev/null +++ b/meteoraddon/src/main/java/com/example/addon/modules/ModuleExample.java @@ -0,0 +1,75 @@ +package com.example.addon.modules; + +import com.example.addon.LauncherManger; +import com.example.addon.launcher; +import it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair; +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.events.world.ServerConnectBeginEvent; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.settings.StringSetting; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.client.input.Input; +import net.minecraft.client.network.ServerAddress; +import net.minecraft.util.math.Vec3d; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static com.example.addon.AddonTemplate.CATEGORY; + + +public class ModuleExample extends Module { + ServerAddress current_addr; + + + LauncherManger lm; + public ModuleExample(LauncherManger lm) { + super(CATEGORY, "Meteor-Bot", "An example module in a custom category."); + MeteorClient.EVENT_BUS.subscribe(new StaticListener()); + + this.lm = lm; + } + + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting botpath = sgGeneral.add(new StringSetting.Builder() + .name("Path") + .description("The location of the bot .minecraft folder") + .defaultValue("/home/astatin3/GitHub/meteorbot/instance") + .visible(() -> true) + .build() + ); + + private final Setting verboseMode = sgGeneral.add(new BoolSetting.Builder() + .name("Verbose") + .description("Enable verbose output") + .defaultValue(true) + .visible(() -> true) + .build() + ); + + public void onActivate() { +// test = new launcher(botpath.get(), "bot", 0, current_addr); +// test.start(); + lm.start(botpath.get(), 8, "bot", current_addr); + } + + @Override + public void onDeactivate() { + if(lm.running()) + lm.stop(); + } + + private class StaticListener { + @EventHandler + private void onGameJoined(ServerConnectBeginEvent event) { + current_addr = event.address; + } + } + +} diff --git a/meteoraddon/src/main/resources/assets/template/icon.png b/meteoraddon/src/main/resources/assets/template/icon.png new file mode 100644 index 0000000..3fb2e7f Binary files /dev/null and b/meteoraddon/src/main/resources/assets/template/icon.png differ diff --git a/meteoraddon/src/main/resources/fabric.mod.json b/meteoraddon/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..33125c4 --- /dev/null +++ b/meteoraddon/src/main/resources/fabric.mod.json @@ -0,0 +1,29 @@ +{ + "schemaVersion": 1, + "id": "addon-template", + "version": "${version}", + "name": "Addon Template", + "description": "An addon template for Meteor Client addons.", + "authors": [ + "seasnail" + ], + "contact": { + "repo": "https://github.com/MeteorDevelopment/meteor-addon-template" + }, + "icon": "assets/template/icon.png", + "environment": "client", + "entrypoints": { + "meteor": [ + "com.example.addon.AddonTemplate" + ] + }, + "mixins": [], + "custom": { + "meteor-client:color": "225,25,25" + }, + "depends": { + "java": ">=21", + "minecraft": ["${mc_version}"], + "meteor-client": "*" + } +} diff --git a/no-more-render/.editorconfig b/no-more-render/.editorconfig new file mode 100644 index 0000000..b722415 --- /dev/null +++ b/no-more-render/.editorconfig @@ -0,0 +1,12 @@ +[*] +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +indent_size = 4 + +[*.{json, yml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/no-more-render/.gitattributes b/no-more-render/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/no-more-render/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/no-more-render/LICENSE b/no-more-render/LICENSE new file mode 100644 index 0000000..1625c17 --- /dev/null +++ b/no-more-render/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. \ No newline at end of file diff --git a/no-more-render/README.md b/no-more-render/README.md new file mode 100644 index 0000000..f417bd2 --- /dev/null +++ b/no-more-render/README.md @@ -0,0 +1,22 @@ +# no-more-render + +A Fabric mod that removes Minecraft's window rendering code, to create a headless CLI version + +## Usage +This mod runs a tcp server locally that allows for a command line interface +The mod runs on the port 65000, and increments this value by 1 if it cannot access that port. +You can connect to it via running `ncat localhost 65000` or other similar command +### Comamnds: +``` +listelements/elems - List widgets on the screen +clickelement/celem - Click an element on the screen +writeelement/welem - Write text into a compatable element + +key - Press and release a key +keydown - Press a key +keyup - Release a key + +connect :[Port] - Forcibly connect to a server + +quit/exit - Close the game +``` diff --git a/no-more-render/build.gradle b/no-more-render/build.gradle new file mode 100644 index 0000000..a6c3373 --- /dev/null +++ b/no-more-render/build.gradle @@ -0,0 +1,89 @@ +plugins { + id 'fabric-loom' version '1.7-SNAPSHOT' + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +base { + archivesName = project.archives_base_name +} + +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +// mavenCentral() +// maven { url 'https://jitpack.io' } +} + +loom { + splitEnvironmentSourceSets() + + mods { + "modid" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + +} + +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Fabric API. This is technically optional, but you probably want it anyway. +// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.release = 21 +} + +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } +} + +// configure the maven publication +publishing { + publications { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } +} diff --git a/no-more-render/compiler.xml b/no-more-render/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/no-more-render/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/no-more-render/gradle.properties b/no-more-render/gradle.properties new file mode 100644 index 0000000..bd037a6 --- /dev/null +++ b/no-more-render/gradle.properties @@ -0,0 +1,17 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G +org.gradle.parallel=true + +# Fabric Properties +# check these on https://fabricmc.net/develop +minecraft_version=1.21 +yarn_mappings=1.21+build.2 +loader_version=0.15.11 + +# Mod Properties +mod_version=1.0.2 +maven_group=com.astatin3 +archives_base_name=nomorerender + +# Dependencies +fabric_version=0.100.3+1.21 diff --git a/no-more-render/gradle.xml b/no-more-render/gradle.xml new file mode 100644 index 0000000..ce1c62c --- /dev/null +++ b/no-more-render/gradle.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/no-more-render/gradle/wrapper/gradle-wrapper.properties b/no-more-render/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a441313 --- /dev/null +++ b/no-more-render/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/no-more-render/gradlew b/no-more-render/gradlew new file mode 100755 index 0000000..b740cf1 --- /dev/null +++ b/no-more-render/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/no-more-render/gradlew.bat b/no-more-render/gradlew.bat new file mode 100644 index 0000000..25da30d --- /dev/null +++ b/no-more-render/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/no-more-render/inspectionProfiles/Project_Default.xml b/no-more-render/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6dbefc3 --- /dev/null +++ b/no-more-render/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/no-more-render/jarRepositories.xml b/no-more-render/jarRepositories.xml new file mode 100644 index 0000000..54ff075 --- /dev/null +++ b/no-more-render/jarRepositories.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/no-more-render/misc.xml b/no-more-render/misc.xml new file mode 100644 index 0000000..2049faf --- /dev/null +++ b/no-more-render/misc.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/no-more-render/modules.xml b/no-more-render/modules.xml new file mode 100644 index 0000000..87936d8 --- /dev/null +++ b/no-more-render/modules.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/no-more-render/modules/com.astatin3.no-more-render.client.iml b/no-more-render/modules/com.astatin3.no-more-render.client.iml new file mode 100644 index 0000000..6121a9c --- /dev/null +++ b/no-more-render/modules/com.astatin3.no-more-render.client.iml @@ -0,0 +1,18 @@ + + + + + + + MIXIN + MCP + FABRIC + + 1 + + + + + + \ No newline at end of file diff --git a/no-more-render/modules/no-more-render.main.iml b/no-more-render/modules/no-more-render.main.iml new file mode 100644 index 0000000..01580e3 --- /dev/null +++ b/no-more-render/modules/no-more-render.main.iml @@ -0,0 +1,18 @@ + + + + + + + FABRIC + MIXIN + MCP + + 1 + + + + + + \ No newline at end of file diff --git a/no-more-render/modules/no-more-render.test.iml b/no-more-render/modules/no-more-render.test.iml new file mode 100644 index 0000000..01580e3 --- /dev/null +++ b/no-more-render/modules/no-more-render.test.iml @@ -0,0 +1,18 @@ + + + + + + + FABRIC + MIXIN + MCP + + 1 + + + + + + \ No newline at end of file diff --git a/no-more-render/runConfigurations/Minecraft_Client.xml b/no-more-render/runConfigurations/Minecraft_Client.xml new file mode 100644 index 0000000..f5242d4 --- /dev/null +++ b/no-more-render/runConfigurations/Minecraft_Client.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/no-more-render/runConfigurations/Minecraft_Server.xml b/no-more-render/runConfigurations/Minecraft_Server.xml new file mode 100644 index 0000000..5444414 --- /dev/null +++ b/no-more-render/runConfigurations/Minecraft_Server.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/no-more-render/settings.gradle b/no-more-render/settings.gradle new file mode 100644 index 0000000..75c4d72 --- /dev/null +++ b/no-more-render/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} \ No newline at end of file diff --git a/no-more-render/src/client/java/com/astatin3/nomorerender/clientEntrypoint.java b/no-more-render/src/client/java/com/astatin3/nomorerender/clientEntrypoint.java new file mode 100644 index 0000000..de0bbe9 --- /dev/null +++ b/no-more-render/src/client/java/com/astatin3/nomorerender/clientEntrypoint.java @@ -0,0 +1,10 @@ +package com.astatin3.nomorerender; + +import net.fabricmc.api.ClientModInitializer; + +public class clientEntrypoint implements ClientModInitializer { + @Override + public void onInitializeClient() { + // This entrypoint is suitable for setting up client-specific logic, such as rendering. + } +} diff --git a/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/BaritoneCommandsAccessor.java b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/BaritoneCommandsAccessor.java new file mode 100644 index 0000000..8cb177e --- /dev/null +++ b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/BaritoneCommandsAccessor.java @@ -0,0 +1,12 @@ +package com.astatin3.nomorerender.mixin.client; + +import org.spongepowered.asm.mixin.Mixin; +//import baritone +//import bar.Baritone; +//import com.jcraft.jogg. +import org.spongepowered.asm.mixin.gen.Accessor; + +//@Mixin(.command.class) +public class BaritoneCommandsAccessor { +// @Accessor("manager") ICommandManager getCmdManager(); +} diff --git a/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessMinecraftClient.java b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessMinecraftClient.java new file mode 100644 index 0000000..25b8d65 --- /dev/null +++ b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessMinecraftClient.java @@ -0,0 +1,371 @@ +package com.astatin3.nomorerender.mixin.client; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.RunArgs; +import net.minecraft.client.gl.WindowFramebuffer; +import net.minecraft.client.gui.hud.InGameHud; +import net.minecraft.client.gui.screen.ChatScreen; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; +import net.minecraft.client.gui.screen.world.WorldListWidget; +import net.minecraft.client.gui.widget.*; +import net.minecraft.client.render.GameRenderer; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.glfw.GLFW; +import net.minecraft.client.network.ServerAddress; +import net.minecraft.client.network.ServerInfo; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.io.*; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; + +@Mixin(MinecraftClient.class) +public class HeadlessMinecraftClient { + +// @Inject(method = "", at = @At("RETURN")) +// private void onInit(CallbackInfo ci) { +// startCommandThread(); +// System.out.println("#########################################"); +// } + + BufferedReader reader; + PrintWriter writer; + + @Shadow private Thread thread; + + + @Shadow + @Final + public InGameHud inGameHud; + @Unique final MinecraftClient self = (MinecraftClient)(Object)this; + + @Inject(method = "", at = @At("TAIL")) + private void onGameLoaded(RunArgs args, CallbackInfo ci) { +// AddonTemplate.LOG.info("Hello from ExampleMixin!"); + System.out.println("#########################################"); + System.out.println("#########################################"); + System.out.println("(no-more-render) This client is running a mod that disables Minecraft from opening a window!"); + System.out.println("#########################################"); + System.out.println("#########################################"); + + startCommandThread(); + self.gameRenderer.onResized(10, 10); + } + + + private void startCommandThread() { + Thread commandThread = new Thread(() -> { +// BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + String line; + int i = 0; + try { + ServerSocket serverSocket; + while(true){ + try { + serverSocket = new ServerSocket(65000+i, 50, InetAddress.getByName("127.0.0.1")); + System.out.println("Server is listening on port " + (65000+i)); + break; + } catch (java.net.BindException e){ + System.out.println("port " + (65000+i) + " failed, trying another"); + i++; + } + } + + System.out.println("(no-more-render) Started!"); + + while (true) { + Socket socket = serverSocket.accept(); + + System.out.println("New client connected"); + + InputStream input = socket.getInputStream(); + OutputStream output = socket.getOutputStream(); + + reader = new BufferedReader(new InputStreamReader(input)); + writer = new PrintWriter(output, true); + +// line = reader.readLine(); + + do { + line = reader.readLine(); + parseCommand(line); + + } while (!line.equals("bye")); + + socket.close(); + +// reader.next + } + + } catch (Exception e) { + e.printStackTrace(); + } + }); + commandThread.setName("Headless Command Thread"); + commandThread.setDaemon(true); + commandThread.start(); + } + + private void parseCommand(String command) { + if(command == null) return; + String[] split = command.split(" "); + try { + switch (split[0].toLowerCase()) { + case "quit": + case "exit": + self.stop(); + break; + case "listelements": + case "elems": + listElements(); + break; + case "clickelement": + case "celem": + clickElement(Integer.parseInt(split[1])); + break; + case "writeelement": + case "welem": + setElemText(Integer.parseInt(split[1]), command.substring(split[0].length()+split[1].length()+2)); + break; + case "key": + if (split.length > 1) { + simulateKeyPress(split[1]); + } + break; + case "keydown": + if (split.length > 1) { + simulateKeyDown(split[1]); + } + break; + case "keyup": + if (split.length > 1) { + simulateKeyUp(split[1]); + } + break; + + case "connect": + if (split.length == 1) + writer.println("You must specify a server address!"); + if (split.length > 3) + writer.println("Too many arguments!"); + else { + + int port = 25565; + + if (split.length == 3) + port = Integer.parseInt(split[2]); + + writer.println("Connecting to: " + split[1] + ":" + port); + connect_to_serv(new ServerAddress(split[1], port)); + } + break; + case "chat": + assert self.player != null; + self.player.networkHandler.sendChatMessage(command.substring(5)); + break; + case "cmd": + assert self.player != null; + self.player.networkHandler.sendCommand(command.substring(4)); + break; + default: + writer.println("Unknown command: " + split[0]); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + private void listElements() { + Screen currentScreen = self.currentScreen; + if (currentScreen == null) { + writer.println("No screen is currently open."); + return; + } + + AtomicInteger index = new AtomicInteger(0); + printElements(currentScreen.children(), 0, index); + } + + + private void printElements(List elements, int depth, AtomicInteger index) { + String indent = " ".repeat(depth); + for (Element element : elements) { + writer.printf("%s%d: %s%n", indent, index.getAndIncrement(), describeElement(element)); + if (element instanceof ClickableWidget) { + ClickableWidget widget = (ClickableWidget) element; + writer.printf("%s Message: %s%n", indent, widget.getMessage().getString()); + } + if (element instanceof net.minecraft.client.gui.ParentElement pe) { + printElements(pe.children(), depth + 1, index); + } else if (element instanceof WorldListWidget wlw) { + printElements(wlw.children(), depth+1, index); + }// else if (element instanceof WorldListWidget.WorldEntry elw) { +// printElements(elw.get, depth+1, index); +// } + } + } + + private String describeElement(Element element) { + return String.format("%s@%s", element.getClass().getSimpleName(), Integer.toHexString(element.hashCode())); + } + + private Element findElement(int targetIndex) { + Screen currentScreen = self.currentScreen; + if (currentScreen == null) { + writer.println("No screen is currently open."); + return null; + } + + AtomicInteger index = new AtomicInteger(0); + return findElementByIndex(currentScreen.children(), targetIndex, index); + } + + private void clickElement(int targetIndex) { + Element targetElement = findElement(targetIndex); + + if (targetElement == null) { + writer.println("Invalid element index."); + return; + } + + if (targetElement instanceof ClickableWidget widget) { + self.execute(() -> { + widget.onClick(widget.getX(), widget.getY()); + }); + writer.println("Clicked element: " + describeElement(widget)); + if (widget.getMessage() != null) { + writer.println("Message: " + widget.getMessage().getString()); + } + } else { + writer.println("Element is not clickable: " + describeElement(targetElement)); + } + } + + private void setElemText(int targetIndex, String text) { + Element targetElement = findElement(targetIndex); + + if (targetElement == null) { + writer.println("Invalid element index."); + return; + } + + + + if (targetElement instanceof TextFieldWidget widget) { + self.execute(() -> { + widget.setText(""); + widget.write(text); + }); + writer.println("Wrote in element: " + describeElement(widget)); + } else { + writer.println("Element is not a TextFieldWidget: " + describeElement(targetElement)); + } + } + + private Element findElementByIndex(List elements, int targetIndex, AtomicInteger currentIndex) { + for (Element element : elements) { + if (currentIndex.getAndIncrement() == targetIndex) { + return element; + } + if (element instanceof net.minecraft.client.gui.ParentElement) { + Element found = findElementByIndex(((net.minecraft.client.gui.ParentElement) element).children(), targetIndex, currentIndex); + if (found != null) { + return found; + } + } + } + return null; + } + + + + private void simulateKeyPress(String keyName) { + int keyCode = getKeyCode(keyName); + if (keyCode != GLFW.GLFW_KEY_UNKNOWN) { + long handle = self.getWindow().getHandle(); + self.execute(() -> { + self.keyboard.onKey(handle, keyCode, 0, GLFW.GLFW_PRESS, 0); + self.keyboard.onKey(handle, keyCode, 0, GLFW.GLFW_RELEASE, 0); + }); + writer.println("Pressed key: " + keyName); + } else { + writer.println("Unknown key: " + keyName); + } + } + + private void simulateKeyDown(String keyName) { + int keyCode = getKeyCode(keyName); + if (keyCode != GLFW.GLFW_KEY_UNKNOWN) { + long handle = self.getWindow().getHandle(); + self.execute(() -> { + self.keyboard.onKey(handle, keyCode, 0, GLFW.GLFW_PRESS, 0); + }); + writer.println("Key down: " + keyName); + } else { + writer.println("Unknown key: " + keyName); + } + } + + private void simulateKeyUp(String keyName) { + int keyCode = getKeyCode(keyName); + if (keyCode != GLFW.GLFW_KEY_UNKNOWN) { + long handle = self.getWindow().getHandle(); + self.execute(() -> { + self.keyboard.onKey(handle, keyCode, 0, GLFW.GLFW_RELEASE, 0); + }); + writer.println("Key up: " + keyName); + } else { + writer.println("Unknown key: " + keyName); + } + } + + private static int getKeyCode(String keyName) { + // Handle special cases + switch (keyName.toLowerCase()) { + case "space": return GLFW.GLFW_KEY_SPACE; + case "enter": return GLFW.GLFW_KEY_ENTER; + case "tab": return GLFW.GLFW_KEY_TAB; + case "escape": return GLFW.GLFW_KEY_ESCAPE; + case "backspace": return GLFW.GLFW_KEY_BACKSPACE; +// case "rightclick": return GLFW.CLI; +// case "leftclick": return GLFW.GLFW_KEY_BACKSPACE; + // Add more special cases as needed + } + + // For single characters, use their ASCII value + if (keyName.length() == 1) { + char c = Character.toUpperCase(keyName.charAt(0)); + if (c >= 'A' && c <= 'Z') { + return GLFW.GLFW_KEY_A + (c - 'A'); + } + if (c >= '0' && c <= '9') { + return GLFW.GLFW_KEY_0 + (c - '0'); + } + } + + // If not found, return unknown key + return GLFW.GLFW_KEY_UNKNOWN; + } + + + public void connect_to_serv(ServerAddress addr){ + self.execute(() -> { + ConnectScreen.connect(self.currentScreen, self, addr, new ServerInfo("Test", addr.getAddress(), ServerInfo.ServerType.OTHER), true, null); + }); + } + +} diff --git a/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWidgetAccessor.java b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWidgetAccessor.java new file mode 100644 index 0000000..dfca33b --- /dev/null +++ b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWidgetAccessor.java @@ -0,0 +1,15 @@ +package com.astatin3.nomorerender.mixin.client; + +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ClickableWidget; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.List; + +@Mixin(Screen.class) +public interface HeadlessWidgetAccessor { + @Accessor("children") List getChildren(); +} diff --git a/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWindow.java b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWindow.java new file mode 100644 index 0000000..29adaf6 --- /dev/null +++ b/no-more-render/src/client/java/com/astatin3/nomorerender/mixin/client/HeadlessWindow.java @@ -0,0 +1,43 @@ +package com.astatin3.nomorerender.mixin.client; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.Window; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.concurrent.atomic.AtomicLong; + +@Mixin(Window.class) +public class HeadlessWindow { +// @Final @Shadow private long handle; +// +// @Inject(method = "", at = @At("RETURN")) +// private void onInit(CallbackInfo ci) { +// // Do nothing, effectively preventing window creation +// } +// +// @Inject(method = "updateWindowRegion", at = @At("HEAD"), cancellable = true) +// private void onUpdateWindowRegion(CallbackInfo ci) { +// ci.cancel(); // Prevent window updates +// } +// +// @Inject(method = "swapBuffers", at = @At("HEAD"), cancellable = true) +// private void onSwapBuffers(CallbackInfo ci) { +// RenderSystem.replayQueue(); +// ci.cancel(); // Prevent buffer swapping +// } +// +// @Inject(method = "setTitle", at = @At("HEAD"), cancellable = true) +// private void onSetTitle(String title, CallbackInfo ci) { +// ci.cancel(); // Prevent title updates +// } +// +// @Inject(method = "toggleFullscreen", at = @At("HEAD"), cancellable = true) +// private void onToggleFullscreen(CallbackInfo ci) { +// ci.cancel(); // Prevent fullscreen toggling +// } +} diff --git a/no-more-render/src/client/resources/assets/nomorerender/icon.png b/no-more-render/src/client/resources/assets/nomorerender/icon.png new file mode 100644 index 0000000..fa1bc4d Binary files /dev/null and b/no-more-render/src/client/resources/assets/nomorerender/icon.png differ diff --git a/no-more-render/src/client/resources/fabric.mod.json b/no-more-render/src/client/resources/fabric.mod.json new file mode 100644 index 0000000..65b79db --- /dev/null +++ b/no-more-render/src/client/resources/fabric.mod.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "id": "nomorerender", + "version": "${version}", + "name": "No More Render", + "description": "This is an example description! Tell everyone what your mod is about!", + "authors": [ + "ASTATIN3" + ], + "contact": { + "homepage": "https://github.com/astatin3", + "sources": "https://github.com/astatin3/no-more-render" + }, + "license": "MIT", + "icon": "assets/nomorerender/icon.png", + "environment": "*", + "entrypoints": { + "client": [ + "com.astatin3.nomorerender.clientEntrypoint" + ] + }, + "mixins": [ + { + "config": "nomorerender.client.mixins.json", + "environment": "client" + } + ], + "depends": { + "fabricloader": ">=0.15.11", + "minecraft": "~1.21", + "java": ">=21" + } +} diff --git a/no-more-render/src/client/resources/nomorerender.client.mixins.json b/no-more-render/src/client/resources/nomorerender.client.mixins.json new file mode 100644 index 0000000..7f0768f --- /dev/null +++ b/no-more-render/src/client/resources/nomorerender.client.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "package": "com.astatin3.nomorerender.mixin.client", + "compatibilityLevel": "JAVA_21", + "client": [ + "HeadlessMinecraftClient", + "HeadlessWidgetAccessor", + "HeadlessWindow" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/no-more-render/vcs.xml b/no-more-render/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/no-more-render/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/no-more-render/workspace.xml b/no-more-render/workspace.xml new file mode 100644 index 0000000..c46d17a --- /dev/null +++ b/no-more-render/workspace.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +