diff options
| author | Elis Eriksson <spelis@spelis.li> | 2026-07-09 03:08:42 +0200 |
|---|---|---|
| committer | Elis Eriksson <spelis@spelis.li> | 2026-07-09 03:08:42 +0200 |
| commit | 5c61713ce5c686b90d415086f2b9260be98e23f7 (patch) | |
| tree | 570ce5ef6b71e3eebaec0cb8697387067d1042af | |
| download | valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar.gz valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar.bz2 valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar.lz valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar.xz valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.tar.zst valvesprint-5c61713ce5c686b90d415086f2b9260be98e23f7.zip | |
| -rw-r--r-- | .gitignore | 27 | ||||
| -rw-r--r-- | LICENSE.txt | 7 | ||||
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | build.gradle | 85 | ||||
| -rw-r--r-- | gradle.properties | 18 | ||||
| -rw-r--r-- | gradle/wrapper/gradle-wrapper.jar | bin | 0 -> 48462 bytes | |||
| -rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 9 | ||||
| -rw-r--r-- | settings.gradle | 9 | ||||
| -rw-r--r-- | src/main/java/li/spelis/client/valvesprintClient.java | 28 | ||||
| -rw-r--r-- | src/main/java/li/spelis/client/valvesprintDataGenerator.java | 12 | ||||
| -rw-r--r-- | src/main/java/li/spelis/valvesprint.java | 10 | ||||
| -rw-r--r-- | src/main/resources/assets/valvesprint/icon.png | bin | 0 -> 181 bytes | |||
| -rw-r--r-- | src/main/resources/assets/valvesprint/lang/en_us.json | 3 | ||||
| -rw-r--r-- | src/main/resources/fabric.mod.json | 34 |
14 files changed, 251 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0127092 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# MacOS DS_Store files +.DS_Store + +# Gradle cache folder +.gradle + +# Gradle build folder +build + +# IntelliJ +out/ +.idea +*.iml +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# Common working directory +run + + +gradlew +gradlew.bat + +valvesprint*.launch
\ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..9bc9e6e --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2026 Elis Eriksson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c594f7 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# ValveSprint + +ValveSneak is a very simple mod that makes Sprinting behave like it does in some Valve games, like Counter Strike and Portal. + +By default, you're sprinting. But if you press the configurable "Walk" button, you start walking normally. + +## Recommended settings + +For an authentic experience, set the Walk key to Left Shift, Sneak to Left Control and unbind Sprinting.
\ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d96f118 --- /dev/null +++ b/build.gradle @@ -0,0 +1,85 @@ +plugins { + id 'net.fabricmc.fabric-loom' version "${loom_version}" + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +base { + archivesName = project.archives_base_name +} + +fabricApi { + configureDataGeneration { + client = true + } +} + +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" +} + +processResources { + inputs.property "version", project.version + inputs.property "minecraft_version", project.minecraft_version + inputs.property "loader_version", project.loader_version + filteringCharset "UTF-8" + + filesMatching("fabric.mod.json") { + expand "version": project.version, + "minecraft_version": project.minecraft_version, + "loader_version": project.loader_version + } +} + +processResources { + // expand all properties from gradle.properties + def stringProperties = providers.gradlePropertiesPrefixedBy('').get() + stringProperties.each { inputs.property(it.key, it.value) } + + filesMatching(['*.mod.json', "*.mixins.json"]) { + expand(stringProperties) { + escapeBackslash = true + } + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.compilerArgs.add('-Xlint:deprecation') + it.options.release = project.java_version as Integer +} + +java { + targetCompatibility = sourceCompatibility = project.java_version as Integer + withSourcesJar() +} + +jar { + inputs.property "archivesName", project.base.archivesName + + from("LICENSE") { + rename { "${it}_${inputs.properties.archivesName}" } + } +} + +// 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/gradle.properties b/gradle.properties new file mode 100644 index 0000000..263a9ae --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G +# Fabric Properties +# check these on https://modmuss50.me/fabric.html +minecraft_version=26.2 +yarn_mappings=1.21.11+build.6 +loader_version=0.18.5 +# Mod Properties +mod_version=1.3 +maven_group=li.spelis +archives_base_name=valvesprint +# Dependencies +# check this on https://modmuss50.me/fabric.html +fabric_version=0.154.2+26.2 + +loom_version=1.17-SNAPSHOT + +java_version=25 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..b1b8ef5 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a9db115 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,9 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..f91a4fe --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } +} diff --git a/src/main/java/li/spelis/client/valvesprintClient.java b/src/main/java/li/spelis/client/valvesprintClient.java new file mode 100644 index 0000000..fcdf37d --- /dev/null +++ b/src/main/java/li/spelis/client/valvesprintClient.java @@ -0,0 +1,28 @@ +package li.spelis.client; + +import com.mojang.blaze3d.platform.InputConstants; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper; +import net.minecraft.client.KeyMapping; +import org.lwjgl.glfw.GLFW; + +public class valvesprintClient implements ClientModInitializer { + private final KeyMapping walkBind = KeyMappingHelper.registerKeyMapping(new KeyMapping( + "key.valvesprint.walk", + InputConstants.Type.KEYSYM, + GLFW.GLFW_KEY_LEFT_SHIFT, + KeyMapping.Category.MOVEMENT + )); + + @Override + public void onInitializeClient() { + ClientTickEvents.START_CLIENT_TICK.register(client -> { + if (client.player != null) { + if (client.player.input.hasForwardImpulse()) { + client.player.setSprinting(!walkBind.isDown()); + } + } + }); + } +} diff --git a/src/main/java/li/spelis/client/valvesprintDataGenerator.java b/src/main/java/li/spelis/client/valvesprintDataGenerator.java new file mode 100644 index 0000000..de85104 --- /dev/null +++ b/src/main/java/li/spelis/client/valvesprintDataGenerator.java @@ -0,0 +1,12 @@ +package li.spelis.client; + +import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; + +public class valvesprintDataGenerator implements DataGeneratorEntrypoint { + + @Override + public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { + FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); + } +} diff --git a/src/main/java/li/spelis/valvesprint.java b/src/main/java/li/spelis/valvesprint.java new file mode 100644 index 0000000..2d9da84 --- /dev/null +++ b/src/main/java/li/spelis/valvesprint.java @@ -0,0 +1,10 @@ +package li.spelis; + +import net.fabricmc.api.ModInitializer; + +public class valvesprint implements ModInitializer { + + @Override + public void onInitialize() { + } +} diff --git a/src/main/resources/assets/valvesprint/icon.png b/src/main/resources/assets/valvesprint/icon.png Binary files differnew file mode 100644 index 0000000..6dbef2d --- /dev/null +++ b/src/main/resources/assets/valvesprint/icon.png diff --git a/src/main/resources/assets/valvesprint/lang/en_us.json b/src/main/resources/assets/valvesprint/lang/en_us.json new file mode 100644 index 0000000..989dfd1 --- /dev/null +++ b/src/main/resources/assets/valvesprint/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "key.valvesprint.walk": "Walk (ValveSprint)" +}
\ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..51e92c5 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,34 @@ +{ + "schemaVersion": 1, + "id": "valvesprint", + "version": "${version}", + "name": "valvesprint", + "description": "Sprint like Gordon Freeman λλλ", + "authors": [ + "Spelis" + ], + "contact": { + "email": "spelis@spelis.li", + "homepage": "https://spelis.li/", + "sources": "https://git.spelis.li/spelis/mc/valvesprint" + }, + "license": "MIT", + "icon": "assets/valvesprint/icon.png", + "environment": "client", + "entrypoints": { + "fabric-datagen": [ + "li.spelis.client.valvesprintDataGenerator" + ], + "client": [ + "li.spelis.client.valvesprintClient" + ], + "main": [ + "li.spelis.valvesprint" + ] + }, + "depends": { + "fabricloader": ">=${loader_version}", + "fabric-api": "*", + "minecraft": "${minecraft_version}" + } +} |
