Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v5
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build
Expand All @@ -33,7 +33,7 @@ jobs:
echo $version
- name: Upload Artifact
if: startsWith(github.event.head_commit.message || '', 'Release')
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: communityradar-${{ env.VERSION }}
path: build/libs/*-${{ env.VERSION }}.jar
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CommunityRadar - Official - Fabric Mod 1.20.4
CommunityRadar - Official - Fabric Mod
==========================
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4.svg)](#code-of-conduct)
Expand Down
13 changes: 5 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,22 @@ repositories {
}

dependencies {
// To change the versions see the gradle.properties file
minecraft(libs.minecraft)
mappings(loom.officialMojangMappings())
modImplementation(libs.fabricLoader)
implementation(libs.fabricLoader)

// Make a set of all api modules we wish to use
setOf(
"fabric-api-base",
"fabric-command-api-v2"
).forEach {
// Add each module as a dependency
modImplementation(fabricApi.module(it, libs.versions.fabricApi.get()))
implementation(fabricApi.module(it, libs.versions.fabricApi.get()))
}

}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
languageVersion.set(JavaLanguageVersion.of(25))
}
// withSourcesJar()
// withJavadocJar()
Expand Down Expand Up @@ -81,7 +78,7 @@ tasks {

withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(21)
options.release.set(25)
}

withType<Javadoc> {
Expand All @@ -93,7 +90,7 @@ tasks {
use()
}

jar {
named<Jar>("jar") {
from("LICENSE") {
rename { "${it}_${archivesName}" }
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.parallel=true
org.gradle.configuration-cache=true

# Mod Properties
mod_version=1.1.0-SNAPSHOT+1.21.11
mod_version=1.0.0-SNAPSHOT+26.1
maven_group=io.github.communityradargg.fabric
archives_base_name=communityradar-fabric

Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[versions]
# Plugins
fabricLoom = "1.14-SNAPSHOT"
fabricLoom = "1.15-SNAPSHOT"
spotless = "8.1.0"

# Libraries
minecraft = "1.21.11"
fabricLoader = "0.18.2"
fabricApi = "0.139.4+1.21.11"
minecraft = "26.1-snapshot-10"
fabricLoader = "0.18.4"
fabricApi = "0.143.6+26.1"

[libraries]
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" }

[plugins]
fabricLoom = { id = "fabric-loom", version.ref = "fabricLoom" }
fabricLoom = { id = "net.fabricmc.fabric-loom", version.ref = "fabricLoom" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }

[bundles]
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import io.github.communityradargg.fabric.utils.Messages;
import io.github.communityradargg.fabric.utils.RadarMessage;
import io.github.communityradargg.fabric.utils.Utils;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommands;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientPacketListener;
Expand All @@ -45,30 +45,30 @@ public class RadarCommand {
private static final PermissionLevel REQUIRED_PERMISSION_LEVEL = PermissionLevel.ALL;

public static void register(final @NotNull CommandDispatcher<FabricClientCommandSource> dispatcher) {
final LiteralCommandNode<FabricClientCommandSource> mainCommand = dispatcher.register(ClientCommandManager.literal(COMMAND_NAME)
final LiteralCommandNode<FabricClientCommandSource> mainCommand = dispatcher.register(ClientCommands.literal(COMMAND_NAME)
.requires(source -> source.getPlayer().permissions().hasPermission(new Permission.HasCommandLevel(REQUIRED_PERMISSION_LEVEL)))
.then(ClientCommandManager.literal("help")
.then(ClientCommands.literal("help")
.executes(context -> handleHelpSubcommand(context.getSource()))
)
.then(ClientCommandManager.literal("lists")
.then(ClientCommands.literal("lists")
.executes(context -> {
handleListsSubcommand(context.getSource());
return Command.SINGLE_SUCCESS;
})
)
.then(ClientCommandManager.literal("check")
.then(ClientCommandManager.argument("player", StringArgumentType.string())
.then(ClientCommands.literal("check")
.then(ClientCommands.argument("player", StringArgumentType.string())
.executes(context -> {
final String player = StringArgumentType.getString(context, "player");
return handleCheckSubcommand(context.getSource(), player);
}))
.executes(context -> handleMissingArgs(context.getSource()))
)
.then(ClientCommandManager.literal("player")
.then(ClientCommandManager.literal("add")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommandManager.argument("player", StringArgumentType.string())
.then(ClientCommandManager.argument("cause", StringArgumentType.greedyString())
.then(ClientCommands.literal("player")
.then(ClientCommands.literal("add")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.then(ClientCommands.argument("player", StringArgumentType.string())
.then(ClientCommands.argument("cause", StringArgumentType.greedyString())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
final String player = StringArgumentType.getString(context, "player");
Expand All @@ -83,9 +83,9 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
)
.executes(context -> handleMissingArgs(context.getSource()))
)
.then(ClientCommandManager.literal("remove")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommandManager.argument("player", StringArgumentType.string())
.then(ClientCommands.literal("remove")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.then(ClientCommands.argument("player", StringArgumentType.string())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
final String player = StringArgumentType.getString(context, "player");
Expand All @@ -99,10 +99,10 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
)
.executes(context -> handleHelpSubcommand(context.getSource()))
)
.then(ClientCommandManager.literal("list")
.then(ClientCommandManager.literal("add")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommandManager.argument("prefix", StringArgumentType.greedyString())
.then(ClientCommands.literal("list")
.then(ClientCommands.literal("add")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.then(ClientCommands.argument("prefix", StringArgumentType.greedyString())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
final String prefix = StringArgumentType.getString(context, "prefix");
Expand All @@ -114,8 +114,8 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
)
.executes(context -> handleMissingArgs(context.getSource()))
)
.then(ClientCommandManager.literal("delete")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommands.literal("delete")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
handleListDeleteSubcommand(context.getSource(), namespace);
Expand All @@ -124,8 +124,8 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
)
.executes(context -> handleMissingArgs(context.getSource()))
)
.then(ClientCommandManager.literal("show")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommands.literal("show")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
handleListShowSubcommand(context.getSource(), namespace);
Expand All @@ -134,9 +134,9 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
)
.executes(context -> handleMissingArgs(context.getSource()))
)
.then(ClientCommandManager.literal("prefix")
.then(ClientCommandManager.argument("namespace", StringArgumentType.string())
.then(ClientCommandManager.argument("prefix", StringArgumentType.greedyString())
.then(ClientCommands.literal("prefix")
.then(ClientCommands.argument("namespace", StringArgumentType.string())
.then(ClientCommands.argument("prefix", StringArgumentType.greedyString())
.executes(context -> {
final String namespace = StringArgumentType.getString(context, "namespace");
final String prefix = StringArgumentType.getString(context, "prefix");
Expand All @@ -151,7 +151,7 @@ public static void register(final @NotNull CommandDispatcher<FabricClientCommand
.executes(context -> handleHelpSubcommand(context.getSource()))
)
.executes(context -> handleHelpSubcommand(context.getSource())));
COMMAND_ALIASES.forEach(alias -> dispatcher.register(ClientCommandManager.literal(alias).redirect(mainCommand)));
COMMAND_ALIASES.forEach(alias -> dispatcher.register(ClientCommands.literal(alias).redirect(mainCommand)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,20 @@
*/
package io.github.communityradargg.fabric.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import io.github.communityradargg.fabric.accessors.AvatarRenderStateAccessor;
import io.github.communityradargg.fabric.utils.Utils;
import net.minecraft.client.renderer.entity.player.AvatarRenderer;
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Avatar;
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.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.UUID;

/**
* An abstract Mixin class for {@link AvatarRenderer}.
*/
@Mixin(AvatarRenderer.class)
public abstract class AvatarRendererMixin {
/**
* Modifies the player name tag. This gets called once every tick with the original non-modified prefix.
*
* @param component The original component to modify.
* @param avatarRenderState The needed local variable of the avatar render state.
* @return Returns the modified local variable.
*/
@ModifyArg(
method = "submitNameTag(Lnet/minecraft/client/renderer/entity/state/AvatarRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitNameTag(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/phys/Vec3;ILnet/minecraft/network/chat/Component;ZIDLnet/minecraft/client/renderer/state/CameraRenderState;)V",
ordinal = 1
),
index = 3
)
private Component modifySubmitNameTag(final Component component, final @Local(index = 1, argsOnly = true) AvatarRenderState avatarRenderState) {
final UUID uuid = ((AvatarRenderStateAccessor) avatarRenderState).communityradar_fabric$getPlayerUuid();

if (uuid == null || !Utils.isOnGrieferGames()) {
return component;
}
return Utils.includePrefixComponent(uuid, component);
}

/**
* Modifies the player entity render state to set the self added uuid field.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class ChatComponentMixin {
* @param component The original chat message component to modify.
* @return Returns the modified local variable.
*/
@ModifyVariable(method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/GuiMessageTag;)V", at = @At(value = "HEAD"), index = 1, argsOnly = true)
@ModifyVariable(method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/multiplayer/chat/GuiMessageSource;Lnet/minecraft/client/multiplayer/chat/GuiMessageTag;)V", at = @At(value = "HEAD"), index = 1, argsOnly = true)
private Component modifyAddMessage(final Component component) {
if (!Utils.isOnGrieferGames()) {
return component;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 2024 - present CommunityRadarGG <https://community-radar.de/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.communityradargg.fabric.mixin;

import com.mojang.blaze3d.vertex.PoseStack;
import io.github.communityradargg.fabric.accessors.AvatarRenderStateAccessor;
import io.github.communityradargg.fabric.utils.Utils;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
import net.minecraft.client.renderer.entity.state.EntityRenderState;
import net.minecraft.client.renderer.state.CameraRenderState;
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 java.util.UUID;

/**
* An abstract Mixin class for {@link EntityRenderer}.
*/
@Mixin(EntityRenderer.class)
public abstract class EntityRendererMixin {
/**
* Modifies the player name tag. This gets called once every tick with the original non-modified prefix.
*
* @param state The original state.
* @param poseStack The original pose stack.
* @param submitNodeCollector The original submit node collector.
* @param camera The original camera.
* @param offset The original offset.
* @param ci The callback info.
*/
@Inject(
method = "submitNameDisplay(Lnet/minecraft/client/renderer/entity/state/EntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;I)V",
at = @At("HEAD")
)
private void modifySubmitNameDisplay(final EntityRenderState state, final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final CameraRenderState camera, final int offset, CallbackInfo ci) {
if (state.nameTag == null || !(state instanceof AvatarRenderState avatarRenderState)) {
return;
}

final UUID uuid = ((AvatarRenderStateAccessor) avatarRenderState).communityradar_fabric$getPlayerUuid();
if (uuid == null || !Utils.isOnGrieferGames()) {
return;
}

state.nameTag = Utils.includePrefixComponent(uuid, state.nameTag);
}
}
3 changes: 2 additions & 1 deletion src/main/resources/communityradar.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"package": "io.github.communityradargg.fabric.mixin",
"compatibilityLevel": "JAVA_21",
"compatibilityLevel": "JAVA_25",
"injectors": {
"defaultRequire": 1
},
Expand All @@ -12,6 +12,7 @@
"AvatarRendererMixin",
"AvatarRenderStateMixin",
"ChatComponentMixin",
"EntityRendererMixin",
"PlayerTabOverlayMixin"
]
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": "~${minecraft_version}",
"java": ">=21",
"java": ">=25",
"fabric-command-api-v2": "*"
},
"custom": {
Expand Down