custom items
This commit is contained in:
@ -5,6 +5,8 @@ import net.fabricmc.api.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jottyfan.gta.gdp.item.ModItems;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
@ -16,5 +18,6 @@ public class GTAGDP implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
ModItems.registerModItems();
|
||||
}
|
||||
}
|
35
src/main/java/de/jottyfan/gta/gdp/item/ModItems.java
Normal file
35
src/main/java/de/jottyfan/gta/gdp/item/ModItems.java
Normal file
@ -0,0 +1,35 @@
|
||||
package de.jottyfan.gta.gdp.item;
|
||||
|
||||
import de.jottyfan.gta.gdp.GTAGDP;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.Settings;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class ModItems {
|
||||
|
||||
public static final Item STUB = registerItem(Identifier.of(GTAGDP.MOD_ID, "stub"), new Item.Settings());
|
||||
|
||||
private static Item registerItem(Identifier identifier, Settings settings) {
|
||||
return Registry.register(Registries.ITEM, identifier,
|
||||
new Item(settings.useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))));
|
||||
}
|
||||
|
||||
public static void registerModItems() {
|
||||
GTAGDP.LOGGER.info("registering mod items for " + GTAGDP.MOD_ID);
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
|
||||
entries.add(STUB);
|
||||
});
|
||||
}
|
||||
}
|
6
src/main/resources/assets/gtagdp/items/stub.json
Normal file
6
src/main/resources/assets/gtagdp/items/stub.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "gtagdp:item/stub"
|
||||
}
|
||||
}
|
3
src/main/resources/assets/gtagdp/lang/de_de.json
Normal file
3
src/main/resources/assets/gtagdp/lang/de_de.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"item.gtagdp.stub": "Stummel"
|
||||
}
|
3
src/main/resources/assets/gtagdp/lang/en_us.json
Normal file
3
src/main/resources/assets/gtagdp/lang/en_us.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"item.gtagdp.stub": "Stub"
|
||||
}
|
6
src/main/resources/assets/gtagdp/models/item/stub.json
Normal file
6
src/main/resources/assets/gtagdp/models/item/stub.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "gtagdp:item/stub"
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/gtagdp/textures/item/stub.png
Normal file
BIN
src/main/resources/assets/gtagdp/textures/item/stub.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Reference in New Issue
Block a user