Compare commits

..

9 commits

22 changed files with 318 additions and 97 deletions

8
.gitattributes vendored Normal file
View file

@ -0,0 +1,8 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf
# These are Windows script files and should use crlf
*.bat text eol=crlf

View file

@ -1,4 +1,4 @@
Copyright (c) 2023, flashwave <me@flash.moe>
Copyright (c) 2023-2024, flashwave <me@flash.moe>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -13,6 +13,3 @@ gradlew downloadAssets
gradlew genSources
gradlew build
```
## Known issues
- UniversalGraves doesn't seem to load skins properly. In true Java fashion, its codebase is a mystery to me and I feel like I'm going in circles.

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}
@ -29,15 +29,15 @@ processResources {
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
it.options.release = 21
it.options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked']
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {

View file

@ -4,11 +4,11 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.22
minecraft_version=1.21
yarn_mappings=1.21+build.8
loader_version=0.15.11
# Mod Properties
mod_version=1.0.1
mod_version=1.1.0
maven_group=net.flashii.mcexts
archives_base_name=flashii-extensions

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

19
gradlew vendored
View file

@ -55,7 +55,7 @@
# 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
# 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/.
@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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
@ -144,7 +145,7 @@ 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
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -201,11 +202,11 @@ 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, 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.
# 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" \

20
gradlew.bat vendored
View file

@ -43,11 +43,11 @@ 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.
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
@ -57,11 +57,11 @@ 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.
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

View file

@ -0,0 +1,19 @@
package net.flashii.mcexts;
import com.mojang.authlib.yggdrasil.ProfileResult;
public class ProfileResultCache {
private static final long CACHE_TIMEOUT = 21600000;
public long readTime;
public ProfileResult value;
public ProfileResultCache(ProfileResult value) {
this.readTime = System.currentTimeMillis();
this.value = value;
}
public boolean needsRefresh() {
return readTime < System.currentTimeMillis() - CACHE_TIMEOUT;
}
}

View file

@ -4,12 +4,15 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.util.Base64;
@ -18,6 +21,7 @@ import java.util.Map;
import java.util.UUID;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.flashii.mcexts.Tools;
public class RPC {
private static final String DEFAULT_SECRET = "meow";
@ -67,48 +71,55 @@ public class RPC {
// sigStr and bodyStr because sigStr must also include the query params if those are present
public static RPCPayload callRpc(String path, String sigStr, String bodyStr)
throws GeneralSecurityException, IOException {
throws GeneralSecurityException, IOException, InterruptedException {
boolean hasBody = bodyStr != null;
String time = getRequestTimestamp();
Tools.Log.info("[FII RPC] {} {} @ {}", hasBody ? "POST" : "GET", path, time);
String hash = createRequestSignature(time, URLs.getRpcPath(path), sigStr);
HttpURLConnection conn = (HttpURLConnection)(new URL(URLs.getRpcUrl(path))).openConnection();
conn.setRequestMethod(hasBody ? "POST" : "GET");
conn.setRequestProperty("X-Mince-Time", time);
conn.setRequestProperty("X-Mince-Hash", hash);
if(hasBody) {
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
try(OutputStream stream = conn.getOutputStream()) {
byte[] input = bodyStr.getBytes(StandardCharsets.UTF_8);
stream.write(input, 0, input.length);
}
URI url;
try {
url = new URI(URLs.getRpcUrl(path));
} catch(URISyntaxException ex) {
// fuck it
throw new IOException(ex.getMessage());
}
StringBuilder sb = new StringBuilder();
try(BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
String line;
while((line = br.readLine()) != null)
sb.append(line);
}
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(url)
.header("X-Mince-Time", time)
.header("X-Mince-Hash", hash);
return getGson().fromJson(sb.toString(), RPCPayload.class);
if(hasBody)
requestBuilder.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString(bodyStr, StandardCharsets.UTF_8));
else
requestBuilder.GET();
HttpRequest request = requestBuilder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if(response.statusCode() != 200)
throw new IOException("RPC request failed: " + response.statusCode());
return getGson().fromJson(response.body(), RPCPayload.class);
}
public static RPCPayload callRpc(String path, String paramStr)
throws GeneralSecurityException, IOException {
throws GeneralSecurityException, IOException, InterruptedException {
return callRpc(path, paramStr, paramStr);
}
public static RPCPayload callRpc(String path, Map<String, Object> params)
throws GeneralSecurityException, IOException {
throws GeneralSecurityException, IOException, InterruptedException {
return callRpc(path, createParamString(params));
}
public static RPCPayload postAuth(UUID id, String name, InetAddress remoteAddr)
throws GeneralSecurityException, IOException {
throws GeneralSecurityException, IOException, InterruptedException {
HashMap<String, Object> params = new HashMap<>();
params.put("id", id);
params.put("name", name);
@ -118,7 +129,7 @@ public class RPC {
}
public static RPCPayload postAuth(UUID id, String name, SocketAddress sockAddr)
throws GeneralSecurityException, IOException {
throws GeneralSecurityException, IOException, InterruptedException {
InetAddress remoteAddr = sockAddr instanceof InetSocketAddress
? ((InetSocketAddress)sockAddr).getAddress()
: InetAddress.getLoopbackAddress();

View file

@ -0,0 +1,8 @@
package net.flashii.mcexts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Tools {
public static final Logger Log = LoggerFactory.getLogger("fiiexts");
}

View file

@ -1,16 +0,0 @@
package net.flashii.mcexts.mixin;
import net.flashii.mcexts.URLs;
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.CallbackInfoReturnable;
@Mixin(targets = "com.mojang.authlib.Environment$1")
public abstract class EnvironmentMixin {
@Inject(method = "getSessionHost()Ljava/lang/String;", at = @At("HEAD"), cancellable = true, remap = false)
private void getSessionHost(CallbackInfoReturnable<String> cir) {
cir.setReturnValue(URLs.getSessionHost());
cir.cancel();
}
}

View file

@ -0,0 +1,19 @@
package net.flashii.mcexts.mixin;
import net.minecraft.client.network.PlayerListEntry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@Mixin(PlayerListEntry.class)
public abstract class PlayerListEntryMixin {
@ModifyVariable(
method = "texturesSupplier(Lcom/mojang/authlib/GameProfile;)Ljava/util/function/Supplier;",
at = @At("STORE"),
ordinal = 0
)
private static boolean texturesSupplier(boolean bl) {
// always enable BL
return true;
}
}

View file

@ -8,8 +8,14 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(PlayerListHud.class)
public abstract class PlayerListHudMixin {
@Redirect(method = "render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isInSingleplayer()Z"))
public boolean redirectIsInSinglePlayer(MinecraftClient client) {
@Redirect(
method = "render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/MinecraftClient;isInSingleplayer()Z"
)
)
public boolean isInSinglePlayer(MinecraftClient client) {
// always enable BL
return true;
}

View file

@ -6,6 +6,7 @@ import java.security.GeneralSecurityException;
import com.mojang.authlib.GameProfile;
import net.flashii.mcexts.RPC;
import net.flashii.mcexts.RPCPayload;
import net.flashii.mcexts.Tools;
import net.minecraft.server.PlayerManager;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@ -16,7 +17,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PlayerManager.class)
public abstract class PlayerManagerMixin {
@Inject(method = "checkCanJoin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/text/Text;", at = @At("HEAD"), cancellable = true)
@Inject(
method = "checkCanJoin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/text/Text;",
at = @At("HEAD"),
cancellable = true
)
private void checkCanJoin(SocketAddress sockAddr, GameProfile profile, CallbackInfoReturnable<Text> cir) {
Text authText = null;
@ -25,13 +30,15 @@ public abstract class PlayerManagerMixin {
if(!payload.is("auth:ok")) {
if(payload.is("error")) {
authText = Text.literal(
payload.getAttrStr(payload.hasAttr("text") ? "text" : "code")
).formatted(Formatting.RED);
String errorCode = payload.getAttrStr("code");
String errorText = payload.hasAttr("text") ? payload.getAttrStr("text") : errorCode;
Tools.Log.info("[FII AUTH] <{}:{}:{}> Error: {} {}", profile.getId(), profile.getName(), sockAddr, errorCode, errorText);
authText = Text.literal(errorText).formatted(Formatting.RED);
} else if(payload.is("auth:authorise")) {
String userName = payload.getAttrStr("user_name");
int userColour = payload.hasAttr("user_colour") ? payload.getAttrInt("user_colour") : 0xFFFFFF;
String url = payload.getAttrStr("url");
Tools.Log.info("[FII AUTH] <{}:{}:{}> Authorising: {} {} {}", profile.getId(), profile.getName(), sockAddr, userName, userColour, url);
authText = Text.literal("Welcome back, ")
.append(Text.literal(userName).styled(style -> style.withColor(userColour).withBold(true)))
@ -43,6 +50,7 @@ public abstract class PlayerManagerMixin {
} else if(payload.is("auth:link")) {
String code = payload.getAttrStr("code");
String url = payload.getAttrStr("url");
Tools.Log.info("[FII AUTH] <{}:{}:{}> Linking: {} {}", profile.getId(), profile.getName(), sockAddr, code, url);
authText = Text.literal("This seems to be the first time you're connecting!\n")
.append(Text.literal("Visit "))
@ -51,15 +59,24 @@ public abstract class PlayerManagerMixin {
.append(Text.literal(code).formatted(Formatting.LIGHT_PURPLE))
.append(Text.literal("\n\nAfter you've approved the attempt, connect to the server again and you should be good to go."));
} else {
Tools.Log.info("[FII AUTH] <{}:{}:{}> Unknown response: {}", profile.getId(), profile.getName(), sockAddr, payload.getName());
authText = Text.literal("Flashii authentication server returned an unknown response, yell at flashwave about this.").formatted(Formatting.RED);
}
} else {
Tools.Log.info("[FII AUTH] <{}:{}:{}> Authentication successful!", profile.getId(), profile.getName(), sockAddr);
}
} catch(IOException ex) {
Tools.Log.error("[FII AUTH] <{}:{}:{}> IOException!!", profile.getId(), profile.getName(), sockAddr);
authText = Text.literal("Flashii authentication server failed to respond, yell at flashwave about this.").formatted(Formatting.RED);
ex.printStackTrace();
} catch(GeneralSecurityException ex) {
Tools.Log.error("[FII AUTH] <{}:{}:{}> GeneralSecurityException!!", profile.getId(), profile.getName(), sockAddr);
authText = Text.literal("Problem with request verification, yell at flashwave about this.").formatted(Formatting.RED);
ex.printStackTrace();
} catch(InterruptedException ex) {
Tools.Log.error("[FII AUTH] <{}:{}:{}> InterruptedException!!", profile.getId(), profile.getName(), sockAddr);
authText = Text.literal("Problem with connecting to the Flashii authentication server, yell at flashwave about this.").formatted(Formatting.RED);
ex.printStackTrace();
}
if(authText != null) {

View file

@ -13,7 +13,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ServerMetadata.class)
public abstract class ServerMetadataMixin {
@Inject(method = "description()Lnet/minecraft/text/Text;", at = @At("TAIL"), cancellable = true)
@Inject(
method = "description()Lnet/minecraft/text/Text;",
at = @At("TAIL"),
cancellable = true
)
public void description(CallbackInfoReturnable<Text> cir) {
String linesRaw = Config.getValue("MOTDLines.txt");
if(linesRaw == null || linesRaw.isBlank())

View file

@ -9,7 +9,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(TextureUrlChecker.class)
public abstract class TextureUrlCheckerMixin {
@Inject(method = "isAllowedTextureDomain(Ljava/lang/String;)Z", at = @At("HEAD"), cancellable = true, remap = false)
@Inject(
method = "isAllowedTextureDomain(Ljava/lang/String;)Z",
at = @At("HEAD"),
cancellable = true,
remap = false
)
private static void isAllowedTextureDomain(String url, CallbackInfoReturnable<Boolean> cir) {
if(url == null || url.startsWith(URLs.getTexturesHostPrefix())) {
cir.setReturnValue(true);

View file

@ -0,0 +1,25 @@
package net.flashii.mcexts.mixin;
import com.mojang.authlib.Environment;
import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
import net.flashii.mcexts.URLs;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(YggdrasilEnvironment.class)
public abstract class YggdrasilEnvironmentMixin {
@Redirect(
method = "<init>",
at = @At(
value = "NEW",
target = "com/mojang/authlib/Environment",
ordinal = 0,
remap = false
),
remap = false
)
private Environment init(String sessionHost, String servicesHost, String name) {
return new Environment(URLs.getSessionHost(), servicesHost, name);
}
}

View file

@ -1,24 +1,140 @@
package net.flashii.mcexts.mixin;
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.SignatureState;
import com.mojang.authlib.minecraft.client.ObjectMapper;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.yggdrasil.ProfileResult;
import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import com.mojang.util.UndashedUuid;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.UUID;
import net.flashii.mcexts.ProfileResultCache;
import net.flashii.mcexts.Tools;
import net.flashii.mcexts.URLs;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(YggdrasilMinecraftSessionService.class)
public abstract class YggdrasilMinecraftSessionServiceMixin {
@ModifyVariable(method = "getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", at = @At("HEAD"), argsOnly = true, remap = false)
private boolean interceptGetTexturesRequireSecure(boolean requireSecure) {
return false;
private static ObjectMapper objectMapper = ObjectMapper.create();
private static HashMap<UUID, ProfileResultCache> profileCache = new HashMap<>();
private static ProfileResult getProfileFromMince(UUID profileId, boolean allowCache) {
if(allowCache && profileCache.containsKey(profileId)) {
ProfileResultCache cachedProfile = profileCache.get(profileId);
if(!cachedProfile.needsRefresh())
return cachedProfile.value;
Tools.Log.info("[FII MIXIN] Cache expired!!!!!!!");
} else {
Tools.Log.info("[FII MIXIN] Forcing new fetch!!!!!!!");
}
ProfileResult profileResult = null;
try {
// this should probably have caching idk at what frequency this will get called
URI url;
try {
url = new URI(String.format("%s/session/minecraft/profile/%s", URLs.getSessionHost(), UndashedUuid.toString(profileId)));
} catch(URISyntaxException ex) {
Tools.Log.info("[FII MIXIN] INCORRECTLY FORMATTED PROFILE URL!!!!!!!!!!");
return profileResult;
}
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder().uri(url).GET().build();
HttpResponse<String> response;
try {
response = client.send(request, HttpResponse.BodyHandlers.ofString());
} catch(IOException | InterruptedException ex) {
Tools.Log.info("[FII MIXIN] FAILED TO SEND PROFILE REQUEST!!!!!!!!!!");
return profileResult;
}
if(response.statusCode() != 200) {
Tools.Log.info("[FII MIXIN] NON-200 PROFILE RESPONSE CODE!!!!!!!!!!");
return profileResult;
}
MinecraftProfilePropertiesResponse profileResponse = objectMapper.readValue(response.body(), MinecraftProfilePropertiesResponse.class);
if(profileResponse != null)
profileResult = new ProfileResult(profileResponse.toProfile());
} finally {
profileCache.put(profileId, new ProfileResultCache(profileResult));
}
return profileResult;
}
@ModifyVariable(method = "fillProfileProperties(Lcom/mojang/authlib/GameProfile;Z)Lcom/mojang/authlib/GameProfile;", at = @At("HEAD"), argsOnly = true, remap = false)
private boolean interceptFillProfilePropertiesRequireSecure(boolean requireSecure) {
return true;
@Inject(
method = "getPackedTextures(Lcom/mojang/authlib/GameProfile;)Lcom/mojang/authlib/properties/Property;",
at = @At("RETURN"),
cancellable = true,
remap = false
)
private void getPackedTextures(GameProfile profile, CallbackInfoReturnable<Property> cir) {
boolean replace = false;
Property prop = cir.getReturnValue();
if(prop == null) {
ProfileResult result = getProfileFromMince(profile.getId(), true);
if(result == null) {
Tools.Log.info("[FII MIXIN] PROFILE RESULT IS NULL!!!!!!!!");
} else {
replace = true;
prop = (Property)Iterables.getFirst(result.profile().getProperties().get("textures"), (Object)null);
}
}
if(replace) {
cir.setReturnValue(prop);
cir.cancel();
}
}
@ModifyVariable(method = "fillGameProfile(Lcom/mojang/authlib/GameProfile;Z)Lcom/mojang/authlib/GameProfile;", at = @At("HEAD"), argsOnly = true, remap = false)
private boolean interceptFillGameProfileRequireSecure(boolean requireSecure) {
return false;
@Inject(
method = "getSecurePropertyValue(Lcom/mojang/authlib/properties/Property;)Ljava/lang/String;",
at = @At("HEAD"),
cancellable = true,
remap = false
)
public void getSecurePropertyValue(Property property, CallbackInfoReturnable<String> cir) {
cir.setReturnValue(property.value());
cir.cancel();
}
@Inject(
method = "getPropertySignatureState(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/SignatureState;",
at = @At("HEAD"),
cancellable = true,
remap = false
)
private void getPropertySignatureState(Property property, CallbackInfoReturnable<SignatureState> cir) {
cir.setReturnValue(SignatureState.SIGNED);
cir.cancel();
}
@Inject(
method = "fetchProfile(Ljava/util/UUID;Z)Lcom/mojang/authlib/yggdrasil/ProfileResult;",
at = @At("HEAD"),
cancellable = true,
remap = false
)
public void fetchProfile(UUID profileId, boolean requireSecure, CallbackInfoReturnable<ProfileResult> cir) {
ProfileResult result = getProfileFromMince(profileId, !requireSecure);
if(result != null) {
cir.setReturnValue(result);
cir.cancel();
}
}
}

View file

@ -19,7 +19,7 @@
],
"depends": {
"fabricloader": ">=0.14.22",
"minecraft": "~1.20.1",
"java": ">=17"
"minecraft": ">=1.21",
"java": ">=21"
}
}

View file

@ -1,11 +1,12 @@
{
"required": true,
"package": "net.flashii.mcexts.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
"EnvironmentMixin",
"PlayerListEntryMixin",
"PlayerListHudMixin",
"TextureUrlCheckerMixin",
"YggdrasilEnvironmentMixin",
"YggdrasilMinecraftSessionServiceMixin"
],
"server": [