Compare commits
19
Commits
4342233876
...
0.1.1-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c16d8fe0 | ||
|
|
e3d1e4a442 | ||
|
|
04605f6855 | ||
|
|
451ac986c0 | ||
|
|
80d478d2c9 | ||
|
|
79719262a2 | ||
|
|
806c4ab643 | ||
|
|
6ee8b64a38 | ||
|
|
a97e5703c9 | ||
|
|
39f140dae1 | ||
|
|
632591f8d8 | ||
|
|
66e994b5ab | ||
|
|
1d56094388 | ||
|
|
69f572288f | ||
|
|
1a5c7f2a2c | ||
|
|
68734f6ac5 | ||
|
|
333c408d1b | ||
|
|
3c57328b3c | ||
|
|
08178b60fe |
@@ -0,0 +1,97 @@
|
||||
name: Release
|
||||
|
||||
# Publishing a release builds every Minecraft version and attaches the mod jars
|
||||
# to it. mod_version in gradle.properties is the source of truth: the release
|
||||
# tag must match it (a leading "v" is allowed), so bump mod_version in a PR
|
||||
# before tagging the release.
|
||||
#
|
||||
# To (re)attach jars to an existing release, run this workflow manually with
|
||||
# the release's tag.
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: Tag of the existing release to build and attach jars to
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
||||
# The public address. Uploads go through the Cloudflare tunnel, which caps
|
||||
# request bodies at 100 MB, so each mod jar must stay under that.
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ env.TAG }}
|
||||
submodules: true
|
||||
|
||||
- name: Check tag matches mod_version
|
||||
run: |
|
||||
MOD_VERSION="$(sed -n 's/^mod_version=//p' gradle.properties | tr -d '[:space:]')"
|
||||
if [ "${TAG#v}" != "$MOD_VERSION" ]; then
|
||||
echo "::error::Release tag '$TAG' doesn't match mod_version '$MOD_VERSION' in gradle.properties. Bump mod_version to '${TAG#v}' on the release branch, or tag the release '$MOD_VERSION'." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Building Saturn Client $MOD_VERSION"
|
||||
|
||||
- name: Set up Java 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
cache: gradle
|
||||
|
||||
- name: Build all versions
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
# buildAll remaps every versions/* project in parallel into build/allJars.
|
||||
./gradlew buildAll --no-daemon --stacktrace
|
||||
|
||||
- name: Upload jars to the release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
shopt -s nullglob
|
||||
jars=(build/allJars/*.jar)
|
||||
if [ ${#jars[@]} -eq 0 ]; then
|
||||
echo "No jars found in build/allJars" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Cloudflare in front of the server rejects uploads of 100 MB or more.
|
||||
for jar in "${jars[@]}"; do
|
||||
size=$(stat -c%s "$jar")
|
||||
if [ "$size" -ge 100000000 ]; then
|
||||
echo "::error::$(basename "$jar") is $((size / 1000000)) MB; uploads must be under 100 MB. Check what's taking space with: unzip -l \"$jar\" | sort -n" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Look the release up by tag so manual runs work too.
|
||||
RELEASE_ID="$(curl --fail-with-body -sS -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/$REPO/releases/tags/$TAG" \
|
||||
| grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2)"
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
echo "No release found for tag $TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for jar in "${jars[@]}"; do
|
||||
echo "Uploading $(basename "$jar") to release $TAG ($RELEASE_ID)"
|
||||
curl --fail-with-body -sS -X POST \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-F "attachment=@$jar" \
|
||||
"$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets"
|
||||
echo
|
||||
done
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[submodule "common"]
|
||||
path = common
|
||||
url = https://github.com/saturnclientmc/common.git
|
||||
url = https://git.selimaj.dev/saturnclientmc/common.git
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ subprojects {
|
||||
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://git.selimaj.dev/api/packages/selimaj-dev/maven" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule common updated: 2cfd93c197...5df42e2b7c
+1
-1
@@ -4,4 +4,4 @@ org.gradle.parallel=true
|
||||
# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
|
||||
org.gradle.configuration-cache=false
|
||||
|
||||
mod_version=0.1.0-beta2
|
||||
mod_version=0.1.1-beta
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.name();
|
||||
UUID uuid = profile.id();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.name();
|
||||
UUID uuid = profile.id();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -65,6 +70,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.getName();
|
||||
UUID uuid = profile.getId();
|
||||
|
||||
if (SaturnPlayer.get(name, uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -65,6 +70,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.getName();
|
||||
UUID uuid = profile.getId();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.getName();
|
||||
UUID uuid = profile.getId();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.getName();
|
||||
UUID uuid = profile.getId();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.getName();
|
||||
UUID uuid = profile.getId();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ base {
|
||||
|
||||
repositories {
|
||||
// maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' }
|
||||
maven { name = "JitPack"; url = 'https://jitpack.io' }
|
||||
maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
|
||||
implementation project(":common")
|
||||
|
||||
include implementation("com.github.selimaj-dev:session-java:0.1.6")
|
||||
include implementation("dev.selimaj:session-java:0.2.0")
|
||||
include implementation("de.javagl:obj:0.4.0")
|
||||
include implementation("com.formdev:svgSalamander:1.1.4")
|
||||
include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
|
||||
|
||||
@@ -3,6 +3,11 @@ package org.saturnclient.impl.provider;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.saturnclient.common.provider.SaturnProvider;
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||
@@ -59,6 +64,23 @@ public class SaturnProviderImpl implements SaturnProvider {
|
||||
SaturnClient.LOGGER.error(message, throwable);
|
||||
}
|
||||
|
||||
/** Shown longer than the vanilla default, since these ask the player to act. */
|
||||
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
|
||||
|
||||
@Override
|
||||
public String getModVersion() {
|
||||
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
|
||||
.map(mod -> mod.getMetadata().getVersion().getFriendlyString())
|
||||
.orElse("unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(String title, String message) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.getToastManager().add(
|
||||
SystemToast.create(client, WARNING_TOAST, Text.literal(title), Text.literal(message))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi) {
|
||||
IdentifierUtils.registerBufferedImageTextureFast(i, bi);
|
||||
|
||||
+25
-19
@@ -1,43 +1,49 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Team;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.saturnclient.client.player.Roles;
|
||||
import org.saturnclient.client.player.SaturnPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class TabListMixin {
|
||||
|
||||
@Shadow
|
||||
private GameProfile profile;
|
||||
|
||||
/**
|
||||
* @author HexLeo
|
||||
* @reason Adds the Saturn Client icon to the player's name if they are online
|
||||
* with Saturn Client
|
||||
* Adds the Saturn Client icon to the player's name if they are online with
|
||||
* Saturn Client, keeping any name, rank prefix or team formatting the server
|
||||
* set.
|
||||
*/
|
||||
@Overwrite
|
||||
@Nullable
|
||||
public Text getDisplayName() {
|
||||
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true)
|
||||
private void saturn$addSaturnIcon(CallbackInfoReturnable<Text> cir) {
|
||||
PlayerListEntry entry = (PlayerListEntry) (Object) this;
|
||||
GameProfile profile = entry.getProfile();
|
||||
String name = profile.name();
|
||||
UUID uuid = profile.id();
|
||||
|
||||
if (SaturnPlayer.get(uuid) != null) {
|
||||
return Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||
if (SaturnPlayer.get(name, uuid) == null) {
|
||||
return;
|
||||
}
|
||||
return Text.literal(name);
|
||||
|
||||
Text displayName = cir.getReturnValue();
|
||||
|
||||
// With no server-set name, vanilla shows the team-decorated profile name.
|
||||
if (displayName == null) {
|
||||
displayName = Team.decorateName(entry.getScoreboardTeam(), Text.literal(name));
|
||||
}
|
||||
|
||||
cir.setReturnValue(Text.empty()
|
||||
.append(Text.literal(Roles.getSaturnIndicator())
|
||||
.styled(style -> style.withColor(Roles.getIconColor(uuid))))
|
||||
.append(displayName));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user