WikiChree.COM
新規
編集
添付
管理
Pitan Mod Wiki
Pitan作マイクラMODの解説Wiki
≡
目次
FrontPage
Video/FabricのMOD開発講座
MOD解説
自作系
Advanced Reborn
Bedrock Tools76
Cubic Turret
Ender Cane
Enhanced Quarries
Item Alchemy
More Harnesses
PipePlus
Simple Uncrafting Table
Space Cube
StorageBox Adapter
Storage Box for Fabric
Universal Wrench
MCPitanLibドキュメント
↑
検索
AND検索
OR検索
最新の10件
2025-12-02
More Harnesses
2025-11-15
StorageBox Adapter/en
StorageBox Adapter
Storage Box for Fabric/en
Storage Box for Fabric
MenuBar
AutoAliasName
2025-09-12
dev/MCPitanLib/Item Addition/en
dev/MCPitanLib/Item Addition
2025-08-08
More Harnesses/en
↑
ツールボックス
新しいページの作成
最近更新したページ
全ページ
ヘルプ
↑
カウンター
総計:
0
今日:
0
昨日:
0
現在:
17
トップ
ヘルプ
PukiWiki
dev/MCPitanLib/Item Addition/en をテンプレートにして作成
開始行:
* How to Add Items with MCPitanLib [#x39c2589]
This guide explains the basic steps to add a new item to ...
It references the implementation in ''ExampleMod.java'' a...
**Prerequisites [#v110afc8]
- MCPitanLib is already integrated into your project.
- Your mod's main class (e.g., ''ExampleMod'') inherits f...
**Steps [#ucbcb02b]
*** 1. Prepare MOD ID and Registry [#l02c5ab2]
Define the MOD ID used for identifying your mod and get t...
#gcode(java){{
public class ExampleMod extends CommonModInitializer {
public static final String MOD_ID = "examplemod"; // ...
public static CompatRegistryV2 registry;
@Override
public void init() {
registry = super.registry; // Get the registry fr...
// ... other initialization processes ...
}
// Helper method to easily create an Identifier using...
public static CompatIdentifier _id(String path) {
return CompatIdentifier.of(MOD_ID, path);
}
@Override
public String getId() {
return MOD_ID;
}
// ...
}
}}
*** 2. Define Item ID [#a8fc76fb]
Define the ID for the item you want to add using ''Compat...
This will be in the format ''MOD_ID:item_name''.
#gcode(java){{
public class ExampleMod extends CommonModInitializer {
// ... (code from above) ...
// Define the Item ID
public static CompatIdentifier EXAMPLE_ITEM_ID = _id(...
// ...
}
}}
*** 3. Prepare Item Instance and Settings [#rbbefa46]
Create an instance of the item to be added.
With MCPitanLib, you typically use the ''CompatItem'' cla...
- '''''CompatibleItemSettings.of()''''': Configures basic...
- '''''CompatItem''''': The most basic item class, which ...
#gcode(java){{
// Defined within ExampleMod.java, either in the init met...
// Variable to hold the registration result of the item (...
public static RegistryResult<Item> EXAMPLE_ITEM;
// Register the item within the init method
@Override
public void init() {
// ...
registry = super.registry;
// ...
// Register the item
EXAMPLE_ITEM = registry.registerItem(EXAMPLE_ITEM_ID,...
new CompatItem(CompatibleItemSettings.of(EXAM...
// .maxCount(16) // For example, if y...
.addGroup(ItemGroups.INGREDIENTS) // ...
)
);
// ...
}
}}
'''Points:'''
- ''CompatibleItemSettings.of(CompatIdentifier id)'': Pas...
- ''.addGroup(ItemGroups.INGREDIENTS)'': Adds the created...
- ''() -> new CompatItem(...)'': Passes a lambda expressi...
*** 4. (Optional) Create a Custom Item Class [#x60ffdd1]
If you want to create an item with more complex behavior,...
#gcode(java){{
// Example: An item with special behavior on right-click
public class MyCustomItem extends CompatItem {
public MyCustomItem(CompatibleItemSettings settings) {
super(settings);
}
@Override
public public StackActionResult onRightClick(ItemUseE...
// Action on right-click
if (!e.isClient())
e.player.sendMessage(TextUtil.literal("Custom...
return e.success();
}
}
// Registration in ExampleMod.java
// ...
public static RegistryResult<Item> MY_CUSTOM_ITEM;
public static CompatIdentifier MY_CUSTOM_ITEM_ID = _id("m...
// ...
// Inside the init method
MY_CUSTOM_ITEM = registry.registerItem(MY_CUSTOM_ITEM_ID,...
new MyCustomItem(CompatibleItemSettings.of(MY_CUS...
.addGroup(ItemGroups.TOOLS) // Add to the...
)
);
// ...
}}
*** Summary [#nef17c9c]
Using MCPitanLib, you can easily add multi versions compa...
The key classes and methods are:
- ''CompatRegistryV2#registerItem(CompatIdentifier id, Su...
- ''CompatIdentifier#of(String modId, String path)''
- ''CompatItem''
- ''CompatibleItemSettings#of(CompatIdentifier id)''
For more detailed settings or custom behaviors, please re...
終了行:
* How to Add Items with MCPitanLib [#x39c2589]
This guide explains the basic steps to add a new item to ...
It references the implementation in ''ExampleMod.java'' a...
**Prerequisites [#v110afc8]
- MCPitanLib is already integrated into your project.
- Your mod's main class (e.g., ''ExampleMod'') inherits f...
**Steps [#ucbcb02b]
*** 1. Prepare MOD ID and Registry [#l02c5ab2]
Define the MOD ID used for identifying your mod and get t...
#gcode(java){{
public class ExampleMod extends CommonModInitializer {
public static final String MOD_ID = "examplemod"; // ...
public static CompatRegistryV2 registry;
@Override
public void init() {
registry = super.registry; // Get the registry fr...
// ... other initialization processes ...
}
// Helper method to easily create an Identifier using...
public static CompatIdentifier _id(String path) {
return CompatIdentifier.of(MOD_ID, path);
}
@Override
public String getId() {
return MOD_ID;
}
// ...
}
}}
*** 2. Define Item ID [#a8fc76fb]
Define the ID for the item you want to add using ''Compat...
This will be in the format ''MOD_ID:item_name''.
#gcode(java){{
public class ExampleMod extends CommonModInitializer {
// ... (code from above) ...
// Define the Item ID
public static CompatIdentifier EXAMPLE_ITEM_ID = _id(...
// ...
}
}}
*** 3. Prepare Item Instance and Settings [#rbbefa46]
Create an instance of the item to be added.
With MCPitanLib, you typically use the ''CompatItem'' cla...
- '''''CompatibleItemSettings.of()''''': Configures basic...
- '''''CompatItem''''': The most basic item class, which ...
#gcode(java){{
// Defined within ExampleMod.java, either in the init met...
// Variable to hold the registration result of the item (...
public static RegistryResult<Item> EXAMPLE_ITEM;
// Register the item within the init method
@Override
public void init() {
// ...
registry = super.registry;
// ...
// Register the item
EXAMPLE_ITEM = registry.registerItem(EXAMPLE_ITEM_ID,...
new CompatItem(CompatibleItemSettings.of(EXAM...
// .maxCount(16) // For example, if y...
.addGroup(ItemGroups.INGREDIENTS) // ...
)
);
// ...
}
}}
'''Points:'''
- ''CompatibleItemSettings.of(CompatIdentifier id)'': Pas...
- ''.addGroup(ItemGroups.INGREDIENTS)'': Adds the created...
- ''() -> new CompatItem(...)'': Passes a lambda expressi...
*** 4. (Optional) Create a Custom Item Class [#x60ffdd1]
If you want to create an item with more complex behavior,...
#gcode(java){{
// Example: An item with special behavior on right-click
public class MyCustomItem extends CompatItem {
public MyCustomItem(CompatibleItemSettings settings) {
super(settings);
}
@Override
public public StackActionResult onRightClick(ItemUseE...
// Action on right-click
if (!e.isClient())
e.player.sendMessage(TextUtil.literal("Custom...
return e.success();
}
}
// Registration in ExampleMod.java
// ...
public static RegistryResult<Item> MY_CUSTOM_ITEM;
public static CompatIdentifier MY_CUSTOM_ITEM_ID = _id("m...
// ...
// Inside the init method
MY_CUSTOM_ITEM = registry.registerItem(MY_CUSTOM_ITEM_ID,...
new MyCustomItem(CompatibleItemSettings.of(MY_CUS...
.addGroup(ItemGroups.TOOLS) // Add to the...
)
);
// ...
}}
*** Summary [#nef17c9c]
Using MCPitanLib, you can easily add multi versions compa...
The key classes and methods are:
- ''CompatRegistryV2#registerItem(CompatIdentifier id, Su...
- ''CompatIdentifier#of(String modId, String path)''
- ''CompatItem''
- ''CompatibleItemSettings#of(CompatIdentifier id)''
For more detailed settings or custom behaviors, please re...
ページ名:
目次
FrontPage
Video/FabricのMOD開発講座
MOD解説
自作系
Advanced Reborn
Bedrock Tools76
Cubic Turret
Ender Cane
Enhanced Quarries
Item Alchemy
More Harnesses
PipePlus
Simple Uncrafting Table
Space Cube
StorageBox Adapter
Storage Box for Fabric
Universal Wrench
MCPitanLibドキュメント
↑
検索
AND検索
OR検索
最新の10件
2025-12-02
More Harnesses
2025-11-15
StorageBox Adapter/en
StorageBox Adapter
Storage Box for Fabric/en
Storage Box for Fabric
MenuBar
AutoAliasName
2025-09-12
dev/MCPitanLib/Item Addition/en
dev/MCPitanLib/Item Addition
2025-08-08
More Harnesses/en
↑
ツールボックス
新しいページの作成
最近更新したページ
全ページ
ヘルプ
↑
カウンター
総計:
0
今日:
0
昨日:
0
現在:
17