サーバにインストールしクライアント側にも同じ Mod のインストールが必要です
必ずバージョンは揃えましょう
環境
サーバ側
macOS 26.4.1
Minecraft 1.20.1
forge 47.4.10
TaCZ 1.1.8
クライアント側
macOS 26.4.1/Windows11Home
Minecraft 1.20.1
forge 47.4.10
TaCZ 1.1.8
サーバ側
compose.yaml
サーバ側は docker compose で起動します
vim compose.yaml
services:mc:image: itzg/minecraft-server
tty:truestdin_open:trueports:-"25565:25565"environment:EULA:"TRUE"MODE:"creative"VERSION:"1.21.11"volumes:# attach the relative directory 'data' to the container's /data path- ./data:/data
mc_mod:image: itzg/minecraft-server
tty:truestdin_open:trueports:-"25566:25565"environment:EULA:"TRUE"MODE:"creative"VERSION:"1.20.1"TYPE:"forge"volumes:# modded world/data directory for the modded server- ./modded-data:/data
# put the CurseForge mod JAR into this local directory- ./timeless_and_classics_zero/mods:/data/mods
# optional config directory for mod/server configs- ./timeless_and_classics_zero/config:/data/config
今回は「クライアント mod」を導入します
mod にはクライアント mod の場合はサーバ側にもクライアント側にも mod を導入する必要があるので注意してください
サーバ側は ./data/mods/examplemod-1.0.0.jar に配置すれば docker compose up -d 時に自動でコンテナ側に mod が配置され有効になります
サーバ側のログを確認して mod のログが流れていれば OK です
あとはクライアント側の Minecraft にも examplemod-1.0.0.jar を導入する必要があります
forge をインストールし mod 配置用のパスに jar を配置すれば OK です
macOS の Java 版 Minecraft に forge MOD をインストールする場合に jar のダブルクリックからだと起動しないことがあります
その場合はシステム設定のプライバシーとセキュリティからブロックされている jar を開けば OK です
クライアント側の mod のパスは /Users/user01/Library/Application Support/minecraft/mods がデフォルトです
diff --git a/gradle.properties b/gradle.properties
index 6c23fa8..810b037 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -7,13 +7,13 @@ org.gradle.daemon=false
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
-minecraft_version=1.20.6
+minecraft_version=1.21.4
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
-minecraft_version_range=[1.20.6,1.21)
+minecraft_version_range=[1.21.4,1.22)
# The Forge version must agree with the Minecraft version to get a valid artifact
-forge_version=50.1.0
+forge_version=54.0.18
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[0,)
# The loader version range can only use the major version of Forge/FML as bounds
@@ -35,7 +35,7 @@ loader_version_range=[0,)
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
-mapping_version=1.20.6
+mapping_version=1.21.4
// 報酬を降らせる処理privatevoidspawnReward(Player player, Level level){// プレイヤーの位置double x = player.getX();double y = player.getY()+20;// プレイヤーの上空20ブロックdouble z = player.getZ();for(int i =0; i <10;++i){// 報酬アイテム(例: ダイヤモンド)
ItemEntity reward =newItemEntity(level, x, y, z, Items.DIAMOND.getDefaultInstance());
level.addFreshEntity(reward);}}