From 5c9dbe95e53bcc6260b3caa298adc13c91d77951 Mon Sep 17 00:00:00 2001 From: Jottyfan Date: Sat, 24 Oct 2026 16:33:09 +0200 Subject: [PATCH] added food --- .../java/de/jottyfan/minecraft/item/Food.java | 17 +++++++++++++++++ .../de/jottyfan/minecraft/item/ModItems.java | 3 +++ .../minecraft/item/ModItemsRegistrator.java | 17 ++++++++++++++--- .../assets/mfmd2627/items/gingerbread.json | 6 ++++++ .../resources/assets/mfmd2627/lang/de_de.json | 1 + .../resources/assets/mfmd2627/lang/en_us.json | 1 + .../mfmd2627/models/item/gingerbread.json | 6 ++++++ .../mfmd2627/textures/item/gingerbread.png | Bin 0 -> 2160 bytes 8 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/main/java/de/jottyfan/minecraft/item/Food.java create mode 100644 src/main/resources/assets/mfmd2627/items/gingerbread.json create mode 100644 src/main/resources/assets/mfmd2627/models/item/gingerbread.json create mode 100644 src/main/resources/assets/mfmd2627/textures/item/gingerbread.png 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 0000000000000000000000000000000000000000..6b6ba3e48df621e7040337cfce5404dfe372f89a GIT binary patch literal 2160 zcmV-$2#@!PP)z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;%|W-~i6jSjr#(000SaNLh0L01FcU01FcV0GgZ_00007 zbV*G`2k8qL5FZoroF(1>00*>5L_t(o!>yNla8=b6#(#UCbM7-QZb%}K1foEis1O(_ zroND>3{9t&svU(=N2e&-vEo$G(#{loAj~L^#rOEAb!r_4M-fpwMp{Hj#PA3Lfe->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