Selaa lähdekoodia

Initial commit

Lortseam 4 vuotta sitten
sitoutus
73989ef759

+ 118 - 0
.gitignore

@@ -0,0 +1,118 @@
+# User-specific stuff
+.idea/
+
+*.iml
+*.ipr
+*.iws
+
+# IntelliJ
+out/
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# 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*
+
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+.gradle
+build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Cache of project
+.gradletasknamecache
+
+**/build/
+
+# Common working directory
+run/
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar

+ 43 - 0
build.gradle

@@ -0,0 +1,43 @@
+plugins {
+    id 'fabric-loom' version '0.6-SNAPSHOT'
+    id "io.freefair.lombok" version "5.3.3.3"
+}
+
+sourceCompatibility = JavaVersion.VERSION_1_8
+targetCompatibility = JavaVersion.VERSION_1_8
+
+archivesBaseName = project.archives_base_name
+version = project.mod_version
+group = project.maven_group
+
+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}"
+}
+
+processResources {
+    inputs.property "version", project.version
+
+    filesMatching("fabric.mod.json") {
+        expand "version": project.version
+    }
+}
+
+tasks.withType(JavaCompile).configureEach {
+    // ensure that the encoding is set to UTF-8, no matter what the system default is
+    // this fixes some edge cases with special characters not displaying correctly
+    // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
+    it.options.encoding = "UTF-8"
+}
+
+java {
+    // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
+    // if it is present.
+    withSourcesJar()
+}
+
+jar {
+    from "LICENSE"
+}

+ 12 - 0
gradle.properties

@@ -0,0 +1,12 @@
+org.gradle.jvmargs=-Xmx1G
+
+# Fabric Properties
+# check these on https://modmuss50.me/fabric.html
+minecraft_version=1.16.5
+yarn_mappings=1.16.5+build.8
+loader_version=0.11.3
+
+# Mod Properties
+mod_version=1.0.0
+maven_group=me.lortseam
+archives_base_name=bettermounthud

+ 1 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1 @@
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip

+ 2 - 0
lombok.config

@@ -0,0 +1,2 @@
+# This file is generated by the 'io.freefair.lombok' Gradle plugin
+config.stopBubbling = true

+ 10 - 0
settings.gradle

@@ -0,0 +1,10 @@
+pluginManagement {
+    repositories {
+        jcenter()
+        maven {
+            name = 'Fabric'
+            url = 'https://maven.fabricmc.net/'
+        }
+        gradlePluginPortal()
+    }
+}

+ 32 - 0
src/main/java/me/lortseam/betterhorsehud/mixin/IngameHudMixin.java

@@ -0,0 +1,32 @@
+package me.lortseam.betterhorsehud.mixin;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.hud.InGameHud;
+import net.minecraft.client.network.ClientPlayerEntity;
+import net.minecraft.entity.LivingEntity;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.*;
+
+@Mixin(InGameHud.class)
+public abstract class IngameHudMixin {
+
+    @Shadow @Final private MinecraftClient client;
+
+    @ModifyConstant(method = "renderMountHealth", constant = @Constant(intValue = 39))
+    private int bettermounthud$moveMountHealthUp(int original) {
+        return original + 10;
+    }
+
+    @Redirect(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;getHeartCount(Lnet/minecraft/entity/LivingEntity;)I"))
+    private int bettermounthud$alwaysRenderFood(InGameHud inGameHud, LivingEntity entity) {
+        return 0;
+    }
+
+    @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasJumpingMount()Z"))
+    private boolean bettermounthud$switchBar(ClientPlayerEntity player) {
+        return player.hasJumpingMount() && client.options.keyJump.isPressed();
+    }
+
+}

+ 12 - 0
src/main/resources/bettermounthud.mixins.json

@@ -0,0 +1,12 @@
+{
+  "required": true,
+  "minVersion": "0.8",
+  "package": "me.lortseam.betterhorsehud.mixin",
+  "compatibilityLevel": "JAVA_8",
+  "client": [
+    "IngameHudMixin"
+  ],
+  "injectors": {
+    "defaultRequire": 1
+  }
+}

+ 26 - 0
src/main/resources/fabric.mod.json

@@ -0,0 +1,26 @@
+{
+  "schemaVersion": 1,
+  "id": "bettermounthud",
+  "version": "${version}",
+  "name": "Better Horse HUD",
+  "description": "Improves the ingame HUD while on a mount",
+  "authors": [
+    "Lortseam"
+  ],
+  "contact": {
+    "email": "lortseam@gmail.com",
+    "sources": "https://gitlab.com/Lortseam/better-mount-hud",
+    "issues": "https://gitlab.com/Lortseam/better-mount-hud/-/issues"
+  },
+  "license": "Apache-2.0",
+  "environment": "client",
+  "mixins": [
+    {
+      "config": "bettermounthud.mixins.json",
+      "environment": "client"
+    }
+  ],
+  "depends": {
+    "fabricloader": ">=0.7.4"
+  }
+}