diff --git a/src/main/java/de/jottyfan/minecraft/item/Food.java b/src/main/java/de/jottyfan/minecraft/item/Food.java new file mode 100644 index 0000000..1841735 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/Food.java @@ -0,0 +1,17 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.world.food.FoodProperties; + +public enum Food { + GINGERBREAD(new FoodProperties.Builder().nutrition(1).saturationModifier(0.1f).build()); + + private final FoodProperties properties; + + private Food(FoodProperties properties) { + this.properties = properties; + } + + public FoodProperties get() { + return properties; + } +} \ No newline at end of file diff --git a/src/main/java/de/jottyfan/minecraft/item/ModItems.java b/src/main/java/de/jottyfan/minecraft/item/ModItems.java index e5a489d..1d1bae0 100644 --- a/src/main/java/de/jottyfan/minecraft/item/ModItems.java +++ b/src/main/java/de/jottyfan/minecraft/item/ModItems.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.world.item.Item; +import net.minecraft.world.item.Item.Properties; /** * @@ -17,6 +18,7 @@ public class ModItems extends ModItemsRegistrator { public static final Item STUB = registerItem("stub", StubItem::new); public static final Item TIN_INGOT = registerItem("tin_ingot"); public static final Item TIN_DUST = registerItem("tin_dust"); + public static final Item GINGERBREAD = registerItem("gingerbread", new Properties().food(Food.GINGERBREAD.get())); public static final List registerItems() { List registeredItems = new ArrayList<>(); @@ -26,6 +28,7 @@ public class ModItems extends ModItemsRegistrator { registeredItems.add(RAW_TIN); registeredItems.add(TIN_INGOT); registeredItems.add(TIN_DUST); + registeredItems.add(GINGERBREAD); return registeredItems; } } diff --git a/src/main/java/de/jottyfan/minecraft/item/ModItemsRegistrator.java b/src/main/java/de/jottyfan/minecraft/item/ModItemsRegistrator.java index e5455d8..c0a61ad 100644 --- a/src/main/java/de/jottyfan/minecraft/item/ModItemsRegistrator.java +++ b/src/main/java/de/jottyfan/minecraft/item/ModItemsRegistrator.java @@ -32,7 +32,18 @@ public abstract class ModItemsRegistrator { * register a new item with the name and its item class * * @param name the name - * @param function the item class + * @param properties the properties; create it with new Item.Properties(); + * @return the registered item + */ + public static final Item registerItem(String name, Properties properties) { + return registerItem(name, properties, Item::new); + } + + /** + * register a new item with the name and its properties + * + * @param name the name + * @param function the function; create it with Item::new * @return the registered item */ public static final Item registerItem(String name, Function function) { @@ -43,8 +54,8 @@ public abstract class ModItemsRegistrator { * register a new item with the name, the properties and the Item class reference * * @param name the name of the item - * @param the properties; create it with new Item.Properties(); - * @param the function; create it with Item::new + * @param properties the properties; create it with new Item.Properties(); + * @param function the function; create it with Item::new * @return the registered item */ public static final Item registerItem(String name, Properties properties, Function function) { diff --git a/src/main/resources/assets/mfmd2627/items/gingerbread.json b/src/main/resources/assets/mfmd2627/items/gingerbread.json new file mode 100644 index 0000000..0772e79 --- /dev/null +++ b/src/main/resources/assets/mfmd2627/items/gingerbread.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "mfmd2627:item/gingerbread" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mfmd2627/lang/de_de.json b/src/main/resources/assets/mfmd2627/lang/de_de.json index 9201d19..70b346a 100644 --- a/src/main/resources/assets/mfmd2627/lang/de_de.json +++ b/src/main/resources/assets/mfmd2627/lang/de_de.json @@ -1,4 +1,5 @@ { + "item.mfmd2627.gingerbread": "Lebkuchen", "item.mfmd2627.stub": "Stummel", "item.mfmd2627.raw_tin": "Zinn", "item.mfmd2627.ruby": "Rubin", diff --git a/src/main/resources/assets/mfmd2627/lang/en_us.json b/src/main/resources/assets/mfmd2627/lang/en_us.json index ea7d030..4185d66 100644 --- a/src/main/resources/assets/mfmd2627/lang/en_us.json +++ b/src/main/resources/assets/mfmd2627/lang/en_us.json @@ -1,4 +1,5 @@ { + "item.mfmd2627.gingerbread": "Gingerbread", "item.mfmd2627.stub": "Stub", "item.mfmd2627.raw_tin": "Tin", "item.mfmd2627.ruby": "Ruby", diff --git a/src/main/resources/assets/mfmd2627/models/item/gingerbread.json b/src/main/resources/assets/mfmd2627/models/item/gingerbread.json new file mode 100644 index 0000000..8a124c8 --- /dev/null +++ b/src/main/resources/assets/mfmd2627/models/item/gingerbread.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mfmd2627:item/gingerbread" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mfmd2627/textures/item/gingerbread.png b/src/main/resources/assets/mfmd2627/textures/item/gingerbread.png new file mode 100644 index 0000000..6b6ba3e Binary files /dev/null and b/src/main/resources/assets/mfmd2627/textures/item/gingerbread.png differ