瀏覽代碼

Updated to Minecraft 20w18a;
New version 1.1.4;

umollu 5 年之前
父節點
當前提交
bfdffe4228
共有 3 個文件被更改,包括 20 次插入19 次删除
  1. 6 8
      build.gradle
  2. 6 6
      gradle.properties
  3. 8 5
      src/main/java/com/umollu/ash/mixin/GameRendererMixin.java

+ 6 - 8
build.gradle

@@ -1,5 +1,5 @@
 plugins {
-	id 'fabric-loom' version '0.2.6-SNAPSHOT'
+	id 'fabric-loom' version '0.2.7-SNAPSHOT'
 	id 'maven-publish'
 }
 
@@ -18,20 +18,18 @@ repositories {
         name "CottonMC"
         url "https://server.bbkr.space/artifactory/libs-release"
     }
+	maven {
+		url "https://maven.fabricmc.net/io/github/prospector/modmenu/"
+	}
 }
 
 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}"
-
-	modImplementation "io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2"
-	include "io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2"
-
+	modImplementation "io.github.cottonmc:cotton-client-commands:${project.clientcommands_version}"
+	include "io.github.cottonmc:cotton-client-commands:${project.clientcommands_version}"
 	implementation 'com.google.code.gson:gson:2.8.6'
 }
 

+ 6 - 6
gradle.properties

@@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G
 
 # Fabric Properties
 	# check these on https://fabricmc.net/use
-	minecraft_version=1.15.2
-	yarn_mappings=1.15.2+build.14
-	loader_version=0.7.8+build.189
+	minecraft_version=20w18a
+	yarn_mappings=20w18a+build.14
+	loader_version=0.8.2+build.194
 
 # Mod Properties
-	mod_version = 1.1.3
+	mod_version = 1.1.4
 	maven_group = com.umollu
 	archives_base_name = ash
 
 # Dependencies
 	# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
-	fabric_version=0.5.1+build.294-1.15
-	clientcommands_version=0.2.1+1.14-pre5-SNAPSHOT
+	fabric_version=0.10.3+build.338-1.16
+	clientcommands_version=1.0.0+1.15.2

+ 8 - 5
src/main/java/com/umollu/ash/mixin/GameRendererMixin.java

@@ -4,6 +4,8 @@ import com.mojang.blaze3d.systems.RenderSystem;
 import com.umollu.ash.AshCommands;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.render.GameRenderer;
+import net.minecraft.client.util.Window;
+import net.minecraft.client.util.math.MatrixStack;
 import net.minecraft.entity.Entity;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.math.Direction;
@@ -11,12 +13,13 @@ import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
 
 @Mixin(GameRenderer.class)
 public class GameRendererMixin {
 
-	@Inject(at = @At(value = "INVOKE", target = "com/mojang/blaze3d/systems/RenderSystem.defaultAlphaFunc()V"), method = "render")
-	public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info) {
+	@Inject(at = @At(value = "INVOKE", target = "com/mojang/blaze3d/systems/RenderSystem.defaultAlphaFunc()V"), method = "render", locals = LocalCapture.CAPTURE_FAILSOFT)
+	public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info , int i, int j, Window window, MatrixStack matrixStack) {
 
 		MinecraftClient client = MinecraftClient.getInstance();
 		Entity cameraEntity = client.getCameraEntity();
@@ -39,13 +42,13 @@ public class GameRendererMixin {
 			float textPosX = 5;
 
 			if (AshCommands.config.align == 1) {
-				textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getStringWidth(ashString)) / 2f - textPosX;
+				textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString)) / 2f - textPosX;
 			}
 			if (AshCommands.config.align == 2) {
-				textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getStringWidth(ashString) - textPosX;
+				textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString) - textPosX;
 			}
 
-			client.textRenderer.drawWithShadow(ashString, textPosX, 5, AshCommands.config.hudColor);
+			client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, 5, AshCommands.config.hudColor);
 			RenderSystem.popMatrix();
 		}
 	}