File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
java/dev/felnull/smlexample
resources/assets/smlexample/models/item Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 7
7
import net .minecraft .resources .ResourceLocation ;
8
8
import net .minecraft .world .item .CreativeModeTabs ;
9
9
import net .minecraft .world .item .Item ;
10
+ import net .minecraft .world .item .ItemStack ;
10
11
11
12
public class SMLExampleItems {
12
13
public static final Item OBJ_MODEL_ITEM = new Item (new FabricItemSettings ());
13
14
public static final Item OBJ_MODEL_ITEM2 = new Item (new FabricItemSettings ());
15
+ public static final Item CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM = new Item (new FabricItemSettings ());
14
16
15
17
public static void init () {
16
18
register ("obj_model_item" , OBJ_MODEL_ITEM );
17
19
register ("obj_model_item2" , OBJ_MODEL_ITEM2 );
20
+ register ("custom_model_data_obj_model_item" , CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM );
18
21
19
22
ItemGroupEvents .MODIFY_ENTRIES_ALL .register ((group , entries ) -> {
20
23
if (group == CreativeModeTabs .BUILDING_BLOCKS ) {
21
24
entries .accept (OBJ_MODEL_ITEM );
22
25
entries .accept (OBJ_MODEL_ITEM2 );
26
+
27
+ entries .accept (CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM );
28
+
29
+ ItemStack customModelDataItem = new ItemStack (CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM );
30
+ customModelDataItem .getOrCreateTag ().putInt ("CustomModelData" , 1 );
31
+ entries .accept (customModelDataItem );
23
32
}
24
33
});
25
34
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "parent" : " item/generated" ,
3
+ "textures" : {
4
+ "layer0" : " item/apple"
5
+ },
6
+ "overrides" : [
7
+ {
8
+ "predicate" : {
9
+ "custom_model_data" : 1
10
+ },
11
+ "model" : " smlexample:item/obj_model_item"
12
+ }
13
+ ]
14
+ }
You can’t perform that action at this time.
0 commit comments