add jaffa cake

This commit is contained in:
zongor 2024-11-03 10:40:25 -05:00
parent d9a38a5ac8
commit 218e8fdaa6
10 changed files with 70 additions and 4 deletions

View File

@ -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

View File

@ -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());

View File

@ -0,0 +1,10 @@
package com.futhark;
import net.fabricmc.api.ClientModInitializer;
public class FutharkModClient implements ClientModInitializer{
@Override
public void onInitializeClient() {
}
}

View File

@ -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);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,3 @@
{
"item.futhark.jaffa_cake": "Jaffa Cake"
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "futhark:item/jaffa_cake"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -26,7 +26,7 @@
"futhark.mixins.json"
],
"depends": {
"fabricloader": ">=0.16.9",
"fabricloader": ">=0.16.0",
"minecraft": "~1.20.1",
"java": ">=17",
"fabric-api": "*"