設定とGUI連携 (MC 26.2)
本書では、Minecraft 26.2 における設定ファイルスキーマ、YACL v3 GUI連携、ModMenuエントリーポイント、ワールド優先順位ルールを解説します。
📊 設定情報ボックス
| 項目 | 値 |
|---|---|
| 設定ファイルパス | config/item-clumps.json |
| ファイル形式 | JSON (DasikLibrary ConfigHelper で管理) |
| 現在のスキーマ版 | configVersion: 1 |
| 設定GUIプロバイダー | YetAnotherConfigLib v3 (YACL) via ModMenu |
| クラスロード分離 | 遅延リフレクション (GuiHelper.getOptionalYaclFactory) |
| 優先順位ルール | 設定ファイルは新規ワールドの初期値、稼働中はGameRulesが優先 |
⚠️ 優先順位ルール:グローバル設定 vs アクティブなワールド
⚠️ 重要なお知らせ:
config/item-clumps.jsonの編集やModMenu GUIでの設定変更は、新規作成されるワールドの初期値を設定するものです。既存のワールドの設定を変更するには、ゲーム内コマンド/gameruleまたはバニラのゲームルール編集画面を使用してください。
📄 JSONファイルスキーマ (config/item-clumps.json)
json
{
"configVersion": 1,
"enableClumping": true,
"maxClumpSize": 9999,
"renderLabels": true,
"mergeRadius": 1,
"labelMinCount": -1
}フィールド定義
| JSONキー | 型 | 初期値 | 説明 |
|---|---|---|---|
configVersion | Integer | 1 | 内部スキーマ移行トラッカー。 |
enableClumping | Boolean | true | メガスタック結合機能の有効/無効。 |
maxClumpSize | Integer | 9999 | 集約エンティティごとのアイテム上限 ($64$ 〜 $2,147,483,647$)。 |
renderLabels | Boolean | true | アイテム上空に浮遊数量ラベルを表示。 |
mergeRadius | Integer | 1 | 水平方向の探索半径 ($1$ 〜 $10$ ブロック)。 |
labelMinCount | Integer | -1 | ラベル表示の最小しきい値 (-1 はバニラ最大スタック数)。 |
🖥️ グラフィカルUI (YACL v3 & ModMenu)
Item Clumps は YetAnotherConfigLib (YACL v3) および ModMenu によるクライアント設定GUIをサポートしています:
+-------------------------------------------------------------------------+
| ITEM CLUMPS CONFIGURATION |
| |
| [ General Settings ] |
| |
| Enable Clumping ............................................ [ ON ] |
| When true, ground items aggressively merge into mega-stacks. |
| |
| Max Clump Size ............................................. [ 9999 ] |
| The hard cap on items per entity. (Hidden if Stack Size Adjuster on) |
| |
| Render Labels .............................................. [ ON ] |
| Renders holographic count above item clumps. |
| |
| Merge Radius ................................... [───●──────────] (1) |
| Horizontal block search radius (1-10 blocks). |
| |
| Label Min Count ............................................ [ -1 ] |
| Minimum item count before label displays (-1 for vanilla max stack). |
| |
| [ Cancel ] [ Save & Quit ] |
+-------------------------------------------------------------------------+安全な遅延クラスロード
YACLやModMenuが導入されていないサーバーやクライアントでクラッシュが発生しないよう、画面の生成処理は GuiHelper.getOptionalYaclFactory で安全に分離されています:
java
// ModMenuIntegration.java (MC 26.2)
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return GuiHelper.getOptionalYaclFactory(
"item_clumps",
"net.instantgratification.item_clumps.config.YaclScreenHelper",
"createScreen"
);
}
}