11package xyz .lisbammisakait .item ;
22
3+ import net .fabricmc .fabric .api .itemgroup .v1 .FabricItemGroup ;
4+ import net .minecraft .item .*;
5+ import net .minecraft .text .Text ;
36import xyz .lisbammisakait .RelightTheThreePointStrategy ;
47import net .fabricmc .fabric .api .itemgroup .v1 .ItemGroupEvents ;
5- import net .minecraft .item .Item ;
6- import net .minecraft .item .ItemGroups ;
7- import net .minecraft .item .Items ;
8- import net .minecraft .item .ToolMaterial ;
98import net .minecraft .registry .Registries ;
109import net .minecraft .registry .Registry ;
1110import net .minecraft .registry .RegistryKey ;
1211import net .minecraft .registry .RegistryKeys ;
1312import net .minecraft .util .Identifier ;
13+ import xyz .lisbammisakait .Skill .YinFengLaiXiangSkill ;
1414
1515import java .util .function .Function ;
16-
1716public class ModItems {
17+ //创建技能物品组
18+ public static final RegistryKey <ItemGroup > SKILL_GROUP_KEY = RegistryKey .of (Registries .ITEM_GROUP .getKey (), Identifier .of (RelightTheThreePointStrategy .MOD_ID , "skill_group" ));
19+ public static final ItemGroup SKILL_GROUP = FabricItemGroup .builder ()
20+ .icon (() -> new ItemStack (ModItems .HUTOUZHANJINQIANG ))
21+ .displayName (Text .translatable ("skillGroup.RelightTheThreePointStrategy" ))
22+ .build ();
23+ //创建武器物品组
24+ public static final RegistryKey <ItemGroup > RTTPS_ITEM_GROUP_KEY = RegistryKey .of (Registries .ITEM_GROUP .getKey (), Identifier .of (RelightTheThreePointStrategy .MOD_ID , "rttps_group" ));
25+ public static final ItemGroup RTTPS_GROUP = FabricItemGroup .builder ()
26+ .icon (() -> new ItemStack (ModItems .FEILONGDUOFENG ))
27+ .displayName (Text .translatable ("rttpsGroup.RelightTheThreePointStrategy" ))
28+ .build ();
29+
1830// public static final Item FEILONGDUOFENG = register("feilongduofeng", Item::new, new Item.Settings());
1931// public static final Item FEILONGDUOFENG = register();
2032// public static Item register(String path, Function<Item.Settings, Item> factory, Item.Settings settings) {
@@ -27,6 +39,10 @@ public class ModItems {
2739 //注册虎头湛金枪
2840 public static final RegistryKey <Item > HUTOUZHANJINQIANG_KEY = RegistryKey .of (RegistryKeys .ITEM , Identifier .of (RelightTheThreePointStrategy .MOD_ID , "hutouzhanjinqiang" ));
2941 public static final Item HUTOUZHANJINQIANG = register (new HutouzhanjinqiangItem (ToolMaterial .GOLD , 6f , 1f , new Item .Settings ().registryKey (HUTOUZHANJINQIANG_KEY )), HUTOUZHANJINQIANG_KEY );
42+ //-----------------------------------------------------------------------------------------------
43+ //注册引凤来翔
44+ public static final RegistryKey <Item > YINFENGLAIXIANG_KEY = RegistryKey .of (RegistryKeys .ITEM , Identifier .of (RelightTheThreePointStrategy .MOD_ID , "yinfenglaixiang" ));
45+ public static final Item YINFENGLAIXIANG = register (new YinFengLaiXiangSkill ( new Item .Settings ().registryKey (YINFENGLAIXIANG_KEY )), YINFENGLAIXIANG_KEY );
3046
3147 public static Item register (Item item , RegistryKey <Item > registryKey ) {
3248 // Register the item.
@@ -36,13 +52,28 @@ public static Item register(Item item, RegistryKey<Item> registryKey) {
3652 }
3753
3854
39- public static void registerToVanillaItemGroups () {
55+ /* public static void registerToVanillaItemGroups() {
4056 ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> {
4157 content.add(FEILONGDUOFENG);
4258 content.add(HUTOUZHANJINQIANG);
4359 });
60+ }*/
61+ public static void registerToSkillGroups () {
62+ Registry .register (Registries .ITEM_GROUP , SKILL_GROUP_KEY , SKILL_GROUP );
63+ ItemGroupEvents .modifyEntriesEvent (SKILL_GROUP_KEY ).register (itemGroup -> {
64+ itemGroup .add (ModItems .YINFENGLAIXIANG );
65+ });
66+ }
67+ public static void registerToRtTPSGroups () {
68+ Registry .register (Registries .ITEM_GROUP , RTTPS_ITEM_GROUP_KEY , RTTPS_GROUP );
69+ ItemGroupEvents .modifyEntriesEvent (RTTPS_ITEM_GROUP_KEY ).register (itemGroup -> {
70+ itemGroup .add (ModItems .FEILONGDUOFENG );
71+ itemGroup .add (ModItems .HUTOUZHANJINQIANG );
72+ });
4473 }
4574 public static void initialize () {
46- registerToVanillaItemGroups ();
75+ registerToSkillGroups ();
76+ registerToRtTPSGroups ();
77+ //registerToVanillaItemGroups();
4778 }
4879}
0 commit comments