Skip to content

Commit a19bd09

Browse files
committed
Update to Minecraft 1.21.4
1 parent 437dc40 commit a19bd09

25 files changed

+156
-123
lines changed

.github/workflows/gradle.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88
runs-on: ubuntu-latest
99
if: "! contains(toJSON(github.event.head_commit.message), '[Skip CI]')"
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212

13-
- name: Set up JDK 17
13+
- name: Set up JDK 21
1414
uses: actions/setup-java@v1
1515
with:
16-
java-version: 17
16+
java-version: 21
1717

1818
- name: Validate Gradle wrapper
19-
uses: gradle/wrapper-validation-action@v1
19+
uses: gradle/wrapper-validation-action@v2
2020

2121
- name: Grant execute permission for gradlew
2222
run: chmod +x gradlew
@@ -25,7 +25,7 @@ jobs:
2525
run: ./gradlew build
2626

2727
- name: Upload build artifacts
28-
uses: actions/upload-artifact@v1
28+
uses: actions/upload-artifact@v4
2929
with:
3030
name: Gomoku
3131
path: build/libs

build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.4-SNAPSHOT'
2+
id 'fabric-loom' version '1.9-SNAPSHOT'
33
id 'maven-publish'
44
}
55

@@ -36,7 +36,7 @@ processResources {
3636

3737
tasks.withType(JavaCompile).configureEach {
3838
it.options.encoding = "UTF-8"
39-
it.options.release = 17
39+
it.options.release = 21
4040
}
4141

4242
base {
@@ -45,8 +45,8 @@ base {
4545

4646
java {
4747
withSourcesJar()
48-
sourceCompatibility = JavaVersion.VERSION_17
49-
targetCompatibility = JavaVersion.VERSION_17
48+
sourceCompatibility = JavaVersion.VERSION_21
49+
targetCompatibility = JavaVersion.VERSION_21
5050
}
5151

5252
jar {

gradle.properties

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
44
# check these on https://modmuss50.me/fabric.html
5-
minecraft_version=1.20.2
6-
yarn_mappings=1.20.2+build.4
7-
loader_version=0.14.24
5+
minecraft_version=1.21.4
6+
yarn_mappings=1.21.4+build.1
7+
loader_version=0.16.9
88
# Mod Properties
99
mod_version=1.0
1010
maven_group=jerozgen
1111
archives_base_name=gomoku
1212
# Dependencies
13-
fabric_version=0.90.7+1.20.2
14-
plasmid_version=0.5.102-SNAPSHOT+1.20.2
13+
fabric_version=0.111.0+1.21.4
14+
plasmid_version=0.6.3-SNAPSHOT+1.21.4

gradle/wrapper/gradle-wrapper.jar

3.81 KB
Binary file not shown.
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

+28-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# 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
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
147+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+
# shellcheck disable=SC2039,SC3045
146149
MAX_FD=$( ulimit -H -n ) ||
147150
warn "Could not query maximum file descriptor limit"
148151
esac
149152
case $MAX_FD in #(
150153
'' | soft) :;; #(
151154
*)
155+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156+
# shellcheck disable=SC2039,SC3045
152157
ulimit -n "$MAX_FD" ||
153158
warn "Could not set maximum file descriptor limit to $MAX_FD"
154159
esac
@@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
193198
done
194199
fi
195200

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
201210

202211
set -- \
203212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
204213
-classpath "$CLASSPATH" \
205214
org.gradle.wrapper.GradleWrapperMain \
206215
"$@"
207216

217+
# Stop when "xargs" is not available.
218+
if ! command -v xargs >/dev/null 2>&1
219+
then
220+
die "xargs is not available"
221+
fi
222+
208223
# Use "xargs" to parse quoted args.
209224
#
210225
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

src/main/java/jerozgen/gomoku/Gomoku.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import jerozgen.gomoku.game.GomokuGame;
55
import net.fabricmc.api.ModInitializer;
66
import net.minecraft.util.Identifier;
7-
import xyz.nucleoid.plasmid.game.GameType;
7+
import xyz.nucleoid.plasmid.api.game.GameType;
88

99
public class Gomoku implements ModInitializer {
1010
public static final String ID = "gomoku";
1111

1212
@Override
1313
public void onInitialize() {
14-
GameType.register(new Identifier(ID, "gomoku"), GomokuConfig.CODEC, GomokuGame::open);
14+
GameType.register(Identifier.of(ID, "gomoku"), GomokuConfig.CODEC, GomokuGame::open);
1515
}
1616
}

src/main/java/jerozgen/gomoku/game/GomokuConfig.java

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
package jerozgen.gomoku.game;
22

3-
import com.mojang.serialization.Codec;
3+
import com.mojang.serialization.MapCodec;
44
import com.mojang.serialization.codecs.RecordCodecBuilder;
55
import jerozgen.gomoku.game.board.BoardConfig;
66
import net.minecraft.block.Block;
77
import net.minecraft.registry.Registries;
88
import net.minecraft.util.dynamic.Codecs;
9-
import xyz.nucleoid.plasmid.game.common.config.PlayerConfig;
10-
import xyz.nucleoid.plasmid.game.stats.GameStatisticBundle;
9+
import xyz.nucleoid.plasmid.api.game.common.config.WaitingLobbyConfig;
10+
import xyz.nucleoid.plasmid.api.game.stats.GameStatisticBundle;
1111

1212
import java.util.List;
1313
import java.util.Optional;
1414

1515
import static net.minecraft.block.Blocks.*;
1616

17-
public record GomokuConfig(PlayerConfig playerConfig, BoardConfig boardConfig, List<List<Block>> blocks,
18-
int firstMovePlaces, int eachMovePlaces, int moveDuration,
19-
Optional<String> statisticBundleNamespace) {
20-
public static final Codec<GomokuConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group(
21-
PlayerConfig.CODEC.fieldOf("players").forGetter(GomokuConfig::playerConfig),
22-
BoardConfig.CODEC.fieldOf("board").forGetter(GomokuConfig::boardConfig),
17+
public record GomokuConfig(
18+
WaitingLobbyConfig players,
19+
BoardConfig board,
20+
List<List<Block>> blocks,
21+
int firstMovePlaces,
22+
int eachMovePlaces,
23+
int moveDuration,
24+
Optional<String> statisticBundleNamespace
25+
) {
26+
public static final MapCodec<GomokuConfig> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
27+
WaitingLobbyConfig.CODEC.fieldOf("players").forGetter(GomokuConfig::players),
28+
BoardConfig.CODEC.fieldOf("board").forGetter(GomokuConfig::board),
2329
Registries.BLOCK.getCodec().listOf().listOf().fieldOf("blocks").orElseGet(GomokuConfig::defaultBlocks).forGetter(GomokuConfig::blocks),
2430
Codecs.POSITIVE_INT.optionalFieldOf("first_move_places", 1).forGetter(GomokuConfig::firstMovePlaces),
2531
Codecs.POSITIVE_INT.optionalFieldOf("each_move_places", 1).forGetter(GomokuConfig::eachMovePlaces),

src/main/java/jerozgen/gomoku/game/GomokuGame.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
import net.minecraft.server.network.ServerPlayerEntity;
66
import net.minecraft.server.world.ServerWorld;
77
import xyz.nucleoid.fantasy.RuntimeWorldConfig;
8-
import xyz.nucleoid.plasmid.game.GameActivity;
9-
import xyz.nucleoid.plasmid.game.GameOpenContext;
10-
import xyz.nucleoid.plasmid.game.GameOpenProcedure;
11-
import xyz.nucleoid.plasmid.game.GameSpace;
12-
import xyz.nucleoid.plasmid.game.event.GameActivityEvents;
13-
import xyz.nucleoid.plasmid.game.rule.GameRuleType;
14-
import xyz.nucleoid.plasmid.game.stats.GameStatisticBundle;
15-
import xyz.nucleoid.plasmid.game.world.generator.TemplateChunkGenerator;
8+
import xyz.nucleoid.plasmid.api.game.GameActivity;
9+
import xyz.nucleoid.plasmid.api.game.GameOpenContext;
10+
import xyz.nucleoid.plasmid.api.game.GameOpenProcedure;
11+
import xyz.nucleoid.plasmid.api.game.GameSpace;
12+
import xyz.nucleoid.plasmid.api.game.event.GameActivityEvents;
13+
import xyz.nucleoid.plasmid.api.game.rule.GameRuleType;
14+
import xyz.nucleoid.plasmid.api.game.stats.GameStatisticBundle;
15+
import xyz.nucleoid.plasmid.api.game.world.generator.TemplateChunkGenerator;
1616

17+
import java.util.Collections;
1718
import java.util.function.Consumer;
1819

1920
public record GomokuGame(GomokuConfig config, Board board, GameSpace gameSpace, ServerWorld world,
2021
GameStatisticBundle statistics) {
2122
public static GameOpenProcedure open(GameOpenContext<GomokuConfig> context) {
2223
var config = context.config();
23-
var board = new Board(config.boardConfig());
24+
var board = new Board(config.board());
2425
var template = board.template();
2526
var generator = new TemplateChunkGenerator(context.server(), template);
2627
var worldConfig = new RuntimeWorldConfig().setGenerator(generator).setTimeOfDay(6000);
@@ -53,7 +54,7 @@ private void tick() {
5354

5455
public void spawn(ServerPlayerEntity player) {
5556
var spawnPos = board.spawnPos();
56-
player.teleport(world, spawnPos.x, spawnPos.y, spawnPos.z, player.getYaw(), player.getPitch());
57+
player.teleport(world, spawnPos.x, spawnPos.y, spawnPos.z, Collections.emptySet(), player.getYaw(), player.getPitch(), true);
5758
}
5859

5960
public void stat(Consumer<GameStatisticBundle> consumer) {

src/main/java/jerozgen/gomoku/game/GomokuStatisticKeys.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import jerozgen.gomoku.Gomoku;
44
import net.minecraft.util.Identifier;
5-
import xyz.nucleoid.plasmid.game.stats.StatisticKey;
5+
import xyz.nucleoid.plasmid.api.game.stats.StatisticKey;
66

77
public final class GomokuStatisticKeys {
88
// global
@@ -14,7 +14,7 @@ public final class GomokuStatisticKeys {
1414
public static final StatisticKey<Integer> BLOCKS_PLACED = StatisticKey.intKey(id("blocks_placed"));
1515

1616
private static Identifier id(String path) {
17-
return new Identifier(Gomoku.ID, path);
17+
return Identifier.of(Gomoku.ID, path);
1818
}
1919

2020
private GomokuStatisticKeys() {}

src/main/java/jerozgen/gomoku/game/GomokuTexts.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
import net.minecraft.text.MutableText;
55
import net.minecraft.text.Text;
66
import net.minecraft.util.Formatting;
7+
import xyz.nucleoid.plasmid.api.game.config.GameConfig;
78

89
public final class GomokuTexts {
910
public static MutableText description(GomokuGame game) {
10-
var chainSize = game.config().boardConfig().winConfig().size();
11-
var gameName = game.gameSpace().getMetadata().sourceConfig().name();
11+
var chainSize = game.config().board().winConfig().size();
12+
var gameName = GameConfig.name(game.gameSpace().getMetadata().sourceConfig());
1213
return Text.empty().formatted(Formatting.GRAY)
1314
.append("\n").append(gameName.copy()
1415
.formatted(Formatting.BOLD)
1516
.formatted(Formatting.WHITE))
1617
.append("\n").append(Text.translatable("text.gomoku.desc" + (chainSize == 5 ? "" : ".custom_chain"),
17-
chainSize))
18+
chainSize))
1819
.append("\n")
1920
.append("\n").append(Text.translatable("text.gomoku.desc.controls.swap",
20-
Text.translatable("text.gomoku.combined_keybind",
21-
Text.translatable("%s", Text.keybind("key.sneak")),
22-
Text.translatable("%s", Text.keybind("key.use")))
23-
.formatted(Formatting.WHITE)))
21+
Text.translatable("text.gomoku.combined_keybind",
22+
Text.keybind("key.sneak"),
23+
Text.keybind("key.use"))
24+
.formatted(Formatting.WHITE)))
2425
.append("\n");
2526

2627
}
@@ -33,11 +34,11 @@ public static MutableText description(GomokuGame game) {
3334

3435
public static MutableText swapRequest$toTarget(ServerPlayerEntity executor) {
3536
return Text.translatable("text.gomoku.swap.request.to_target",
36-
executor.getDisplayName(),
37-
Text.translatable("text.gomoku.combined_keybind",
38-
Text.translatable("%s", Text.keybind("key.sneak")),
39-
Text.translatable("%s", Text.keybind("key.use")))
40-
.formatted(Formatting.WHITE))
37+
executor.getDisplayName(),
38+
Text.translatable("text.gomoku.combined_keybind",
39+
Text.keybind("key.sneak"),
40+
Text.keybind("key.use"))
41+
.formatted(Formatting.WHITE))
4142
.formatted(Formatting.GRAY);
4243
}
4344

0 commit comments

Comments
 (0)