diff --git a/gradle.properties b/gradle.properties index 89ee934..2054769 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,10 @@ org.gradle.parallel=true # check these on https://fabricmc.net/develop minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 -loader_version=0.16.9 +loader_version=0.16.0 # Mod Properties -mod_version=1.0.0 +mod_version=0.0.1-1.20.1 maven_group=com.futhark archives_base_name=futhark diff --git a/src/main/java/com/futhark/Futhark.java b/src/main/java/com/futhark/Futhark.java index 6e02e01..eace8f1 100644 --- a/src/main/java/com/futhark/Futhark.java +++ b/src/main/java/com/futhark/Futhark.java @@ -1,5 +1,6 @@ package com.futhark; +import com.futhark.item.ModItems; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.player.UseBlockCallback; @@ -16,7 +17,7 @@ public class Futhark implements ModInitializer { @Override public void onInitialize() { LOGGER.info("Hello from Futhark!"); - //ModItems.initialize(); + ModItems.initialize(); UseBlockCallback.EVENT.register(((player, world, hand, hitResult) -> { LOGGER.info(hand.toString()); diff --git a/src/main/java/com/futhark/FutharkModClient.java b/src/main/java/com/futhark/FutharkModClient.java new file mode 100644 index 0000000..70d0d82 --- /dev/null +++ b/src/main/java/com/futhark/FutharkModClient.java @@ -0,0 +1,10 @@ +package com.futhark; + +import net.fabricmc.api.ClientModInitializer; + +public class FutharkModClient implements ClientModInitializer{ + @Override + public void onInitializeClient() { + + } +} diff --git a/src/main/java/com/futhark/item/ModItems.java b/src/main/java/com/futhark/item/ModItems.java new file mode 100644 index 0000000..4102cf9 --- /dev/null +++ b/src/main/java/com/futhark/item/ModItems.java @@ -0,0 +1,46 @@ +package com.futhark.item; + +import com.futhark.Futhark; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.fabricmc.fabric.api.registry.CompostingChanceRegistry; +import net.fabricmc.fabric.api.registry.FuelRegistry; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.item.FoodComponent; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class ModItems extends Item { + public ModItems(Settings settings) { + super(settings); + } + + public static final FoodComponent JAFFA_CAKE_FOOD_COMPONENT = new FoodComponent.Builder() + .alwaysEdible() + .snack() + .hunger(10) + .saturationModifier(1.5f) + // The duration is in ticks, 20 ticks = 1 second + .statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 120 * 20, 2), 1.0f) + .build(); + + public static final Item JAFFA_CAKE = register( + new Item(new FabricItemSettings().food(JAFFA_CAKE_FOOD_COMPONENT)), + "jaffa_cake" + ); + + public static Item register(Item item, String id) { + return Registry.register(Registries.ITEM, new Identifier(Futhark.MOD_ID, id), item); + } + + public static void initialize() { + Futhark.LOGGER.info("Registering Items"); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register((itemGroup) -> itemGroup.add(ModItems.JAFFA_CAKE)); + CompostingChanceRegistry.INSTANCE.add(ModItems.JAFFA_CAKE, 1.0f); + FuelRegistry.INSTANCE.add(ModItems.JAFFA_CAKE, 30 * 20); + } +} diff --git a/src/main/resources/assets/futhark/icon.png b/src/main/resources/assets/futhark/icon.png index 6573f4d..c0f6505 100644 Binary files a/src/main/resources/assets/futhark/icon.png and b/src/main/resources/assets/futhark/icon.png differ diff --git a/src/main/resources/assets/futhark/icon.png~ b/src/main/resources/assets/futhark/icon.png~ new file mode 100644 index 0000000..6573f4d Binary files /dev/null and b/src/main/resources/assets/futhark/icon.png~ differ diff --git a/src/main/resources/assets/futhark/lang/en_us.json b/src/main/resources/assets/futhark/lang/en_us.json new file mode 100644 index 0000000..f19b304 --- /dev/null +++ b/src/main/resources/assets/futhark/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "item.futhark.jaffa_cake": "Jaffa Cake" +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/item/jaffa_cake.json b/src/main/resources/assets/futhark/models/item/jaffa_cake.json new file mode 100644 index 0000000..d77e653 --- /dev/null +++ b/src/main/resources/assets/futhark/models/item/jaffa_cake.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "futhark:item/jaffa_cake" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/textures/item/jaffa_cake.png b/src/main/resources/assets/futhark/textures/item/jaffa_cake.png new file mode 100644 index 0000000..737b4fd Binary files /dev/null and b/src/main/resources/assets/futhark/textures/item/jaffa_cake.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6e9d5f5..39af29d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,7 @@ "futhark.mixins.json" ], "depends": { - "fabricloader": ">=0.16.9", + "fabricloader": ">=0.16.0", "minecraft": "~1.20.1", "java": ">=17", "fabric-api": "*"