Skip to content

Commit 4a889df

Browse files
committed
feat(update): update to 1.21.3 and add feature request in #51
1 parent bc9198f commit 4a889df

File tree

11 files changed

+52
-13
lines changed

11 files changed

+52
-13
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Use the official ArchLinux image with a AUR helper installed
2+
FROM ghcr.io/greyltc-org/archlinux-aur:paru
3+
4+
RUN pacman-key --init
5+
RUN pacman -Syu --noconfirm
6+
7+
# Install required packages
8+
RUN pacman -S base-devel git openssh nano jdk21-openjdk gradle --noconfirm

.devcontainer/devcontainer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Development Container",
3+
"dockerFile": "Dockerfile",
4+
"customizations": {
5+
"vscode": {
6+
"settings": {
7+
"terminal.integrated.shell.linux": "/bin/bash"
8+
},
9+
"extensions": []
10+
}
11+
}
12+
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "architectury-plugin" version "3.4-SNAPSHOT"
3-
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
3+
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
44
}
55

66
architectury {

common/src/main/java/de/rafael/modflared/mixin/client/ServerEntryMixin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
88
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
99
import net.minecraft.client.network.ServerInfo;
10+
import net.minecraft.client.render.RenderLayer;
1011
import net.minecraft.text.Text;
1112
import net.minecraft.util.Formatting;
1213
import net.minecraft.util.Identifier;
@@ -28,15 +29,15 @@ public abstract class ServerEntryMixin {
2829
@Shadow @Final private MultiplayerScreen screen;
2930

3031
@Unique
31-
private static final Identifier MODFLARED_INDICATOR_TEXTURE = Identifier.of(Modflared.MOD_ID, "textures/gui/indicator.png");
32+
private static final Identifier MODFLARED_INDICATOR_TEXTURE = Identifier.of(Modflared.MOD_ID, "icon/indicator");
3233

3334
@Inject(method = "render", at = @At("TAIL"))
3435
public void render(@NotNull DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
3536
var tunnelStatus = ((IServerInfo) server).getTunnelStatus();
3637
if(tunnelStatus != null && tunnelStatus.state() == TunnelStatus.State.USE) {
3738
int xOffset = entryWidth - 15;
3839
int yOffset = 10 + 1;
39-
context.drawTexture(MODFLARED_INDICATOR_TEXTURE, x + xOffset, y + yOffset, 0, 0, 10, 10, 10, 10);
40+
context.drawGuiTexture(RenderLayer::getGuiTextured, MODFLARED_INDICATOR_TEXTURE, x + xOffset, y + yOffset, 10, 10);
4041

4142
// Tooltip
4243
int l = mouseX - x;

common/src/main/java/de/rafael/modflared/tunnel/RunningTunnel.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.*;
1919
import java.net.InetSocketAddress;
2020
import java.util.concurrent.CompletableFuture;
21+
import java.util.zip.CRC32;
2122

2223
public record RunningTunnel(Access access, Process process) {
2324

@@ -59,12 +60,24 @@ public void closeTunnel() {
5960
public record Access(String protocol, String hostname, InetSocketAddress tunnelAddress) {
6061
@Contract("_ -> new")
6162
public static @NotNull Access localWithRandomPort(String host) {
62-
return new Access("tcp", host, new InetSocketAddress("127.0.0.1", (int) (Math.random() * 10000 + 25565)));
63+
return new Access("tcp", host, new InetSocketAddress("127.0.0.1", computePort(host)));
6364
}
6465

6566
public String @NotNull [] command(@NotNull String fileName, boolean prefix) {
6667
return new String[] {(prefix && Platform.get() != Platform.WINDOWS ? "./" : "") + fileName, "access", protocol, "--hostname", hostname, "--url", tunnelAddress.getHostString() + ":" + tunnelAddress.getPort()};
6768
}
69+
70+
public static int computePort(@NotNull String host) {
71+
final int MIN_PORT = 25565;
72+
final int MAX_PORT = 65530;
73+
final int RANGE = MAX_PORT - MIN_PORT + 1;
74+
75+
CRC32 crc32 = new CRC32();
76+
crc32.update(host.getBytes());
77+
long hash = crc32.getValue();
78+
79+
return (int) ((hash % RANGE) + MIN_PORT);
80+
}
6881
}
6982

7083
}

common/src/main/resources/assets/modflared/textures/gui/indicator.png renamed to common/src/main/resources/assets/modflared/textures/gui/sprites/icon/indicator.png

File renamed without changes.

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ org.gradle.jvmargs=-Xmx2G
33
org.gradle.parallel=true
44

55
# Game Properties
6-
minecraft_version=1.21
7-
yarn_version=1.21+build.7
6+
minecraft_version=1.21.3
7+
yarn_version=1.21.3+build.2
88
yarn_mappings_patch=1.21+build.4
99
enabled_platforms=fabric,neoforge
1010

1111
# Mod Properties
1212
archives_base_name=modflared
1313
mod_version=1.2.2
1414
maven_group=de.rafael
15-
mod_minecraft_version=1.21
15+
mod_minecraft_version=1.21.3
1616

1717
# Loader Properties
18-
fabric_loader_version=0.15.11
19-
fabric_api_version=0.100.4+1.21
20-
neoforge_version=21.0.42-beta
18+
fabric_loader_version=0.16.9
19+
fabric_api_version=0.108.0+1.21.3
20+
neoforge_version=21.3.31-beta
2121

2222
# Modrinth Properties
2323
modrinth_project_id=modflared

gradle/wrapper/gradle-wrapper.jar

130 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87-
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
8891

8992
# Use the maximum available, or set MAX_FD != -1 to use that value.
9093
MAX_FD=maximum

0 commit comments

Comments
 (0)