Skip to content

update to 26.1 (well snapshots at least)#15

Merged
GalvinPython merged 10 commits intomainfrom
chore/26.1-update
Mar 23, 2026
Merged

update to 26.1 (well snapshots at least)#15
GalvinPython merged 10 commits intomainfrom
chore/26.1-update

Conversation

@GalvinPython
Copy link
Owner

No description provided.

Copilot AI and others added 6 commits January 19, 2026 18:10
Co-authored-by: GalvinPython <77013913+GalvinPython@users.noreply.github.com>
Co-authored-by: GalvinPython <77013913+GalvinPython@users.noreply.github.com>
@GalvinPython GalvinPython self-assigned this Jan 19, 2026
@GalvinPython GalvinPython added the enhancement New feature or request label Jan 19, 2026
changed Formatting to ChatFormatting and Command arguments has its own built-in entities suggestions
changed Formatting to ChatFormatting and Command arguments has its own built-in entities suggestions
@GalvinPython GalvinPython marked this pull request as ready for review March 23, 2026 19:11
Copilot AI review requested due to automatic review settings March 23, 2026 19:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to update the mod’s build configuration and code to target a newer Minecraft snapshot/version line (including raising the Java target), and adjusts command/dimension APIs accordingly.

Changes:

  • Bump declared Minecraft/Java/Fabric API versions in fabric.mod.json and gradle.properties.
  • Update Gradle/Loom configuration and Java toolchain target to 25.
  • Refactor /findplayer command + utility code to newer (Mojang-named) Minecraft APIs and remove the custom suggestion provider.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/main/resources/fabric.mod.json Updates declared dependency constraints (Minecraft/Java).
src/main/java/me/imgalvin/playerfinder/PlayerFinder.java Refactors command registration/execution and message formatting; adds logging.
src/main/java/me/imgalvin/playerfinder/PlayerFinderUtils.java Migrates dimension/color utilities to new key types and adds debug output.
src/main/java/me/imgalvin/playerfinder/PlayerSuggestionProvider.java Removes custom suggestion provider (no longer used with entity argument).
gradle.properties Updates version properties for Minecraft/Fabric API and mod version.
build.gradle Changes Loom plugin id, dependency configurations, and Java release/version.
.github/workflows/build.yml Restricts workflow triggers via paths and bumps CI Java version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// note: this function only works for vanilla dimensions. custom dimensions will have a slight issue
return playerDimension.getValue().toString().split(":")[1].replace("the_", "");
public String getDimensionText(@NotNull ResourceKey<Level> playerDimension) {
return playerDimension.identifier().getPath().replace("the_", "");
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourceKey does not typically expose identifier(); the standard accessor for the underlying id is usually location() (returning a ResourceLocation). As written, this is likely a compile error; use the appropriate accessor and then take the path for display.

Suggested change
return playerDimension.identifier().getPath().replace("the_", "");
return playerDimension.location().getPath().replace("the_", "");

Copilot uses AI. Check for mistakes.
Comment on lines +23 to 24
System.out.println("Calculating distance between " + playerPos + " and " + targetPos);
return (int) Math.sqrt(Math.pow(playerPos.getX() - targetPos.getX(), 2) + Math.pow(playerPos.getY() - targetPos.getY(), 2) + Math.pow(playerPos.getZ() - targetPos.getZ(), 2));
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The System.out.println in getDistance will spam stdout on every /findplayer call. Remove this debug print or route it through the mod logger at a debug level.

Suggested change
System.out.println("Calculating distance between " + playerPos + " and " + targetPos);
return (int) Math.sqrt(Math.pow(playerPos.getX() - targetPos.getX(), 2) + Math.pow(playerPos.getY() - targetPos.getY(), 2) + Math.pow(playerPos.getZ() - targetPos.getZ(), 2));
return (int) Math.sqrt(
Math.pow(playerPos.getX() - targetPos.getX(), 2)
+ Math.pow(playerPos.getY() - targetPos.getY(), 2)
+ Math.pow(playerPos.getZ() - targetPos.getZ(), 2)
);

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +39
ServerPlayer targetPlayerName = EntityArgument.getPlayer(context, "player");
String playerName = targetPlayerName.getGameProfile().name();

ServerPlayer targetPlayer = context.getSource().getServer().getPlayerList().getPlayer(playerName);
ServerPlayer sourcePlayer = context.getSource().getServer().getPlayerList().getPlayer(context.getSource().getTextName());

if (targetPlayer == null) {
context.getSource().sendSystemMessage(Component.literal("[PlayerFinder ERROR] Player " + playerName + " not found").withStyle(ChatFormatting.RED));
return 0;
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EntityArgument.getPlayer(context, "player") already returns the resolved ServerPlayer, but the code then extracts a name and does a second lookup via getPlayerList().getPlayer(...). This is redundant and can produce null/incorrect results if the player state changes; use the ServerPlayer returned by the argument directly.

Suggested change
ServerPlayer targetPlayerName = EntityArgument.getPlayer(context, "player");
String playerName = targetPlayerName.getGameProfile().name();
ServerPlayer targetPlayer = context.getSource().getServer().getPlayerList().getPlayer(playerName);
ServerPlayer sourcePlayer = context.getSource().getServer().getPlayerList().getPlayer(context.getSource().getTextName());
if (targetPlayer == null) {
context.getSource().sendSystemMessage(Component.literal("[PlayerFinder ERROR] Player " + playerName + " not found").withStyle(ChatFormatting.RED));
return 0;
}
ServerPlayer targetPlayer = EntityArgument.getPlayer(context, "player");
String playerName = targetPlayer.getGameProfile().getName();
ServerPlayer sourcePlayer = context.getSource().getServer().getPlayerList().getPlayer(context.getSource().getTextName());

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +52
ResourceKey<Level> playerDimension = targetPlayer.level().getLevel().dimension();
ResourceKey<Level> sourceDimension = sourcePlayer.level().getLevel().dimension();
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dimension key retrieval uses targetPlayer.level().getLevel().dimension(). For a ServerPlayer, level() already returns the level instance; the extra getLevel() call is likely invalid and will not compile. Use the level API directly to get the dimension key (e.g., targetPlayer.level().dimension()).

Suggested change
ResourceKey<Level> playerDimension = targetPlayer.level().getLevel().dimension();
ResourceKey<Level> sourceDimension = sourcePlayer.level().getLevel().dimension();
ResourceKey<Level> playerDimension = targetPlayer.level().dimension();
ResourceKey<Level> sourceDimension = sourcePlayer.level().dimension();

Copilot uses AI. Check for mistakes.
LOGGER.info("Target player dimension: {}", playerDimension);
LOGGER.info("Source player dimension: {}", sourceDimension);

boolean isSameDimension = sourceDimension == playerDimension;
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSameDimension compares ResourceKey instances with ==. Use .equals(...) to compare keys reliably, since reference equality is not guaranteed.

Suggested change
boolean isSameDimension = sourceDimension == playerDimension;
boolean isSameDimension = sourceDimension.equals(playerDimension);

Copilot uses AI. Check for mistakes.
});
LOGGER.info("PlayerFinder initialized!");
// _ previously registryAccess, environment
CommandRegistrationCallback.EVENT.register((dispatcher, _, _) -> dispatcher.register(Commands.literal("findplayer")
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda parameters are named _, but a single underscore is a reserved keyword in Java (since Java 9), so this will not compile. Rename these unused parameters to something like registryAccess/environment or ignoredRegistryAccess/ignoredEnvironment.

Suggested change
CommandRegistrationCallback.EVENT.register((dispatcher, _, _) -> dispatcher.register(Commands.literal("findplayer")
CommandRegistrationCallback.EVENT.register((dispatcher, ignoredRegistryAccess, ignoredEnvironment) -> dispatcher.register(Commands.literal("findplayer")

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +35
ServerPlayer targetPlayer = context.getSource().getServer().getPlayerList().getPlayer(playerName);
ServerPlayer sourcePlayer = context.getSource().getServer().getPlayerList().getPlayer(context.getSource().getTextName());

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking up sourcePlayer by context.getSource().getTextName() is fragile and also breaks for non-player command sources. Prefer using the command source API to obtain the executing player directly (e.g., getPlayer() / getPlayerOrException() depending on mappings), and handle the exception or allow console execution explicitly.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +15
public ChatFormatting getDimensionColor(@NotNull ResourceKey<Level> playerDimension) {
return playerDimension.equals(ServerLevel.OVERWORLD) ? ChatFormatting.GREEN :
playerDimension.equals(ServerLevel.NETHER) ? ChatFormatting.RED :
playerDimension.equals(ServerLevel.END) ? ChatFormatting.LIGHT_PURPLE :
ChatFormatting.GRAY; // Fallback colour for custom or unknown dimensions
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDimensionColor compares a ResourceKey<Level> against ServerLevel.OVERWORLD/NETHER/END. These constants are typically defined on Level (the key type) rather than ServerLevel; align the constants/types so the comparisons are valid for the key you accept.

Copilot uses AI. Check for mistakes.
@GalvinPython
Copy link
Owner Author

yolo

@GalvinPython GalvinPython merged commit b0f3e04 into main Mar 23, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants