Skip to content

Commit

Permalink
Bump to 1.21.1 and disable Realms functionality to reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
59xa committed Aug 10, 2024
1 parent bbda177 commit d3ac66f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.9
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.1
loader_version=0.15.11

# Mod Properties
mod_version=1.0+1.21
mod_version=1.0+1.21.1
maven_group=com.xand.reconnectmod
archives_base_name=reconnect-mod-reloaded

# Dependencies
fabric_version=0.100.8+1.21
fabric_version=0.102.0+1.21.1
10 changes: 8 additions & 2 deletions src/main/java/com/xand/reconnectmod/mixin/RMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ private void addReconnectButton(CallbackInfo ci) {

// Initialise boolean to determine if the client is in a singleplayer world
boolean inSingleplayer = this.client.isInSingleplayer();
boolean inRealms = false;

// Determine if the player is in a Realms world
ServerInfo currentServer = this.client.getCurrentServerEntry();
if (currentServer != null && currentServer.address != null && currentServer.address.endsWith(".realms.minecraft.net")) {
inRealms = true;
}

// Execute if-statement if the user is not in a singleplayer world
if (!inSingleplayer) {
if (!inSingleplayer && !inRealms) {
LOGGER.info(ANSI_YELLOW + "Player not in a singleplayer world, displaying the reconnect button");
MutableText text = (MutableText) Text.of("R");
this.addDrawableChild(new ReconnectButtonWidget(
Expand All @@ -50,7 +57,6 @@ private void addReconnectButton(CallbackInfo ci) {
LOGGER.info(ANSI_YELLOW + "Reconnect button pressed, attempting to reconnect player to current server");

// Fetch current server the player is in
ServerInfo currentServer = this.client.getCurrentServerEntry();
ServerAddress serverIp = ServerAddress.parse(currentServer.address);

// Disconnects player from the server they currently are in
Expand Down
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": ">=0.15.11",
"minecraft": "~1.21",
"minecraft": "~1.21.1",
"java": ">=21",
"fabric-api": "*"
},
Expand Down

0 comments on commit d3ac66f

Please sign in to comment.