diff --git a/README.md b/README.md index 5b336ea..c351486 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # futhark-fabric +A minecraft alpha era inspired mod adding old functionality, nostalgic items, and a magic system inspired by the Bukkit plugin Runecraft diff --git a/gradle.properties b/gradle.properties index 2054769..3fa9dec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,8 @@ 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.0 +loader_version=0.15.6 +# change loader version to 0.15.1 for deployment # Mod Properties mod_version=0.0.1-1.20.1 diff --git a/src/main/java/com/futhark/Futhark.java b/src/main/java/com/futhark/Futhark.java index eace8f1..89ec608 100644 --- a/src/main/java/com/futhark/Futhark.java +++ b/src/main/java/com/futhark/Futhark.java @@ -1,9 +1,15 @@ package com.futhark; +import com.futhark.block.ModBlocks; +import com.futhark.item.ModItemGroups; import com.futhark.item.ModItems; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.registry.Registries; import net.minecraft.util.ActionResult; import org.slf4j.Logger; @@ -17,7 +23,9 @@ public class Futhark implements ModInitializer { @Override public void onInitialize() { LOGGER.info("Hello from Futhark!"); - ModItems.initialize(); + ModItems.init(); + ModBlocks.init(); + ModItemGroups.init(); 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 index 70d0d82..184ee10 100644 --- a/src/main/java/com/futhark/FutharkModClient.java +++ b/src/main/java/com/futhark/FutharkModClient.java @@ -1,6 +1,8 @@ package com.futhark; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; +import net.minecraft.client.render.entity.MinecartEntityRenderer; public class FutharkModClient implements ClientModInitializer{ @Override diff --git a/src/main/java/com/futhark/block/ModBlocks.java b/src/main/java/com/futhark/block/ModBlocks.java index 015bfe5..f70105b 100644 --- a/src/main/java/com/futhark/block/ModBlocks.java +++ b/src/main/java/com/futhark/block/ModBlocks.java @@ -1,8 +1,36 @@ package com.futhark.block; -import net.minecraft.block.Block; + +import com.futhark.Futhark; +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.*; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.Identifier; public class ModBlocks extends Block { public ModBlocks(Settings settings) { - super(settings); + super(settings); + } + + public static final Block JAFFA_JAM_BLOCK = register("jaffa_jam_block", + new SlimeBlock(FabricBlockSettings.copyOf(Blocks.SLIME_BLOCK).mapColor(MapColor.ORANGE).nonOpaque())); + + public static final Block RUNE_BLOCK = register("rune_block", + new RuneBlock(FabricBlockSettings.copyOf(Blocks.STONE))); + + public static Block register(String id, Block block) { + Registry.register(Registries.ITEM, new Identifier(Futhark.MOD_ID, id), new BlockItem(block, new FabricItemSettings())); + return Registry.register(Registries.BLOCK, new Identifier(Futhark.MOD_ID, id), block); + } + + public static void init() { + Futhark.LOGGER.info("Registering Blocks"); + BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.JAFFA_JAM_BLOCK, RenderLayer.getTranslucent()); } } diff --git a/src/main/java/com/futhark/block/RuneBlock.java b/src/main/java/com/futhark/block/RuneBlock.java new file mode 100644 index 0000000..7be1f63 --- /dev/null +++ b/src/main/java/com/futhark/block/RuneBlock.java @@ -0,0 +1,25 @@ +package com.futhark.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class RuneBlock extends Block { + + public RuneBlock(Settings settings) { + super(settings); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + world.playSound(player, pos, SoundEvents.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE.value(), SoundCategory.BLOCKS, 1f, 1f); + return ActionResult.SUCCESS; + } +} diff --git a/src/main/java/com/futhark/item/ModItemGroups.java b/src/main/java/com/futhark/item/ModItemGroups.java index fca3189..9135a56 100644 --- a/src/main/java/com/futhark/item/ModItemGroups.java +++ b/src/main/java/com/futhark/item/ModItemGroups.java @@ -1,4 +1,30 @@ package com.futhark.item; +import com.futhark.Futhark; +import com.futhark.block.ModBlocks; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + public class ModItemGroups { + public static final ItemGroup FUTHARK_GROUP = Registry.register(Registries.ITEM_GROUP, + new Identifier(Futhark.MOD_ID, "jaffa"), + FabricItemGroup.builder().displayName(Text.translatable("itemgroup.jaffa")) + .icon(() -> new ItemStack(ModItems.JAFFA_CAKE)) + .entries(((displayContext, entries) -> { + entries.add(ModBlocks.JAFFA_JAM_BLOCK); + entries.add(ModBlocks.RUNE_BLOCK); + entries.add(ModItems.JAFFA_SPONGE); + entries.add(ModItems.JAFFA_JAM); + entries.add(ModItems.JAFFA_CAKE); + entries.add(ModItems.RUNIC_CHISEL); + })).build()); + + public static void init() { + Futhark.LOGGER.info("Registering Item Groups"); + } } diff --git a/src/main/java/com/futhark/item/ModItems.java b/src/main/java/com/futhark/item/ModItems.java index 4102cf9..c1c104c 100644 --- a/src/main/java/com/futhark/item/ModItems.java +++ b/src/main/java/com/futhark/item/ModItems.java @@ -22,25 +22,48 @@ public class ModItems extends Item { public static final FoodComponent JAFFA_CAKE_FOOD_COMPONENT = new FoodComponent.Builder() .alwaysEdible() .snack() - .hunger(10) - .saturationModifier(1.5f) + .hunger(6) + .saturationModifier(0.8f) // The duration is in ticks, 20 ticks = 1 second .statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 120 * 20, 2), 1.0f) .build(); + public static final FoodComponent UNFINISHED_JAFFA_FOOD_COMPONENT = new FoodComponent.Builder() + .snack() + .hunger(1) + .build(); + public static final Item JAFFA_CAKE = register( - new Item(new FabricItemSettings().food(JAFFA_CAKE_FOOD_COMPONENT)), - "jaffa_cake" + "jaffa_cake", + new Item(new FabricItemSettings().food(JAFFA_CAKE_FOOD_COMPONENT)) ); - public static Item register(Item item, String id) { + public static final Item JAFFA_JAM = register( + "jaffa_jam", + new Item(new FabricItemSettings().food(UNFINISHED_JAFFA_FOOD_COMPONENT)) + ); + + public static final Item JAFFA_SPONGE = register( + "jaffa_sponge", + new Item(new FabricItemSettings().food(UNFINISHED_JAFFA_FOOD_COMPONENT)) + ); + + public static final Item RUNIC_CHISEL = register( + "runic_chisel", + new RunicChiselItem(new FabricItemSettings().maxDamage(64).fireproof()) + ); + + public static Item register(String id, Item item) { return Registry.register(Registries.ITEM, new Identifier(Futhark.MOD_ID, id), item); } - public static void initialize() { + public static void init() { 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); + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((itemGroup) -> itemGroup.add(ModItems.JAFFA_JAM)); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((itemGroup) -> itemGroup.add(ModItems.JAFFA_SPONGE)); } } diff --git a/src/main/java/com/futhark/item/RunicChiselItem.java b/src/main/java/com/futhark/item/RunicChiselItem.java new file mode 100644 index 0000000..b310eed --- /dev/null +++ b/src/main/java/com/futhark/item/RunicChiselItem.java @@ -0,0 +1,34 @@ +package com.futhark.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.ActionResult; +import net.minecraft.util.math.BlockPos; + +import static com.futhark.block.ModBlocks.RUNE_BLOCK; + +public class RunicChiselItem extends Item { + public RunicChiselItem(Settings settings) { + super(settings); + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + if (!context.getWorld().isClient()) { + BlockPos pos = context.getBlockPos(); + PlayerEntity player = context.getPlayer(); + BlockState state = context.getWorld().getBlockState(pos); + if (state.isOf(Blocks.STONE)) { + context.getWorld().setBlockState(pos, RUNE_BLOCK.getDefaultState()); + } else if (state.isOf(RUNE_BLOCK)) { + context.getWorld().setBlockState(pos, Blocks.STONE.getDefaultState()); + } + } + + return ActionResult.SUCCESS; + } +} diff --git a/src/main/resources/assets/futhark/blockstates/jaffa_jam_block.json b/src/main/resources/assets/futhark/blockstates/jaffa_jam_block.json index e69de29..e31a09c 100644 --- a/src/main/resources/assets/futhark/blockstates/jaffa_jam_block.json +++ b/src/main/resources/assets/futhark/blockstates/jaffa_jam_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "futhark:block/jaffa_jam_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/blockstates/rune_block.json b/src/main/resources/assets/futhark/blockstates/rune_block.json new file mode 100644 index 0000000..db84bca --- /dev/null +++ b/src/main/resources/assets/futhark/blockstates/rune_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "futhark:block/rune_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/icon.png~ b/src/main/resources/assets/futhark/icon.png~ deleted file mode 100644 index 6573f4d..0000000 Binary files a/src/main/resources/assets/futhark/icon.png~ and /dev/null differ diff --git a/src/main/resources/assets/futhark/lang/en_us.json b/src/main/resources/assets/futhark/lang/en_us.json index f19b304..deb99af 100644 --- a/src/main/resources/assets/futhark/lang/en_us.json +++ b/src/main/resources/assets/futhark/lang/en_us.json @@ -1,3 +1,11 @@ { - "item.futhark.jaffa_cake": "Jaffa Cake" -} \ No newline at end of file + "itemgroup.jaffa": "Futhark", + + "item.futhark.jaffa_cake": "Jaffa Cake", + "item.futhark.jaffa_jam": "Jaffa Jam", + "item.futhark.jaffa_sponge": "Jaffa Sponge", + "item.futhark.runic_chisel": "Runic Chisel", + + "block.futhark.jaffa_jam_block": "Block of Jaffa Jam", + "block.futhark.rune_block": "Rune Block" +} diff --git a/src/main/resources/assets/futhark/models/block/jaffa_jam_block.json b/src/main/resources/assets/futhark/models/block/jaffa_jam_block.json index e69de29..c36a42e 100644 --- a/src/main/resources/assets/futhark/models/block/jaffa_jam_block.json +++ b/src/main/resources/assets/futhark/models/block/jaffa_jam_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "futhark:block/jaffa_jam_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/block/rune_block.json b/src/main/resources/assets/futhark/models/block/rune_block.json new file mode 100644 index 0000000..0e49a0c --- /dev/null +++ b/src/main/resources/assets/futhark/models/block/rune_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "futhark:block/rune_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/item/jaffa_jam.json b/src/main/resources/assets/futhark/models/item/jaffa_jam.json index d77e653..a6e5346 100644 --- a/src/main/resources/assets/futhark/models/item/jaffa_jam.json +++ b/src/main/resources/assets/futhark/models/item/jaffa_jam.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "futhark:item/jaffa_cake" + "layer0": "futhark:item/jaffa_jam" } } \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/item/jaffa_jam_block.json b/src/main/resources/assets/futhark/models/item/jaffa_jam_block.json index c36a42e..9e8d42a 100644 --- a/src/main/resources/assets/futhark/models/item/jaffa_jam_block.json +++ b/src/main/resources/assets/futhark/models/item/jaffa_jam_block.json @@ -1,6 +1,3 @@ { - "parent": "block/cube_all", - "textures": { - "all": "futhark:block/jaffa_jam_block" - } + "parent": "futhark:block/jaffa_jam_block" } \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/item/rune_block.json b/src/main/resources/assets/futhark/models/item/rune_block.json new file mode 100644 index 0000000..c1c5fc4 --- /dev/null +++ b/src/main/resources/assets/futhark/models/item/rune_block.json @@ -0,0 +1,3 @@ +{ + "parent": "futhark:block/rune_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/models/item/runic_chisel.json b/src/main/resources/assets/futhark/models/item/runic_chisel.json new file mode 100644 index 0000000..8515169 --- /dev/null +++ b/src/main/resources/assets/futhark/models/item/runic_chisel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "futhark:item/runic_chisel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/futhark/textures/block/jaffa_cake.png b/src/main/resources/assets/futhark/textures/block/jaffa_jam_block.png similarity index 89% rename from src/main/resources/assets/futhark/textures/block/jaffa_cake.png rename to src/main/resources/assets/futhark/textures/block/jaffa_jam_block.png index 737b4fd..16518ce 100644 Binary files a/src/main/resources/assets/futhark/textures/block/jaffa_cake.png and b/src/main/resources/assets/futhark/textures/block/jaffa_jam_block.png differ diff --git a/src/main/resources/assets/futhark/textures/block/jaffa_jam_block_old.png b/src/main/resources/assets/futhark/textures/block/jaffa_jam_block_old.png new file mode 100644 index 0000000..880b316 Binary files /dev/null and b/src/main/resources/assets/futhark/textures/block/jaffa_jam_block_old.png differ diff --git a/src/main/resources/assets/futhark/textures/block/rune_block.png b/src/main/resources/assets/futhark/textures/block/rune_block.png new file mode 100644 index 0000000..855df6c Binary files /dev/null and b/src/main/resources/assets/futhark/textures/block/rune_block.png differ diff --git a/src/main/resources/assets/futhark/textures/item/jaffa_jam.png b/src/main/resources/assets/futhark/textures/item/jaffa_jam.png index 737b4fd..5d225d6 100644 Binary files a/src/main/resources/assets/futhark/textures/item/jaffa_jam.png and b/src/main/resources/assets/futhark/textures/item/jaffa_jam.png differ diff --git a/src/main/resources/assets/futhark/textures/item/jaffa_jam_block.png b/src/main/resources/assets/futhark/textures/item/jaffa_jam_block.png new file mode 100644 index 0000000..16518ce Binary files /dev/null and b/src/main/resources/assets/futhark/textures/item/jaffa_jam_block.png differ diff --git a/src/main/resources/assets/futhark/textures/item/runic_chisel.png b/src/main/resources/assets/futhark/textures/item/runic_chisel.png new file mode 100644 index 0000000..b037ab1 Binary files /dev/null and b/src/main/resources/assets/futhark/textures/item/runic_chisel.png differ diff --git a/src/main/resources/data/futhark/loot_tables/blocks/jaffa_jam_block.json b/src/main/resources/data/futhark/loot_tables/blocks/jaffa_jam_block.json new file mode 100644 index 0000000..9c25b8d --- /dev/null +++ b/src/main/resources/data/futhark/loot_tables/blocks/jaffa_jam_block.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "futhark:jaffa_jam_block" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/futhark/recipes/jaffa_jam_block.json b/src/main/resources/data/futhark/recipes/jaffa_jam_block.json new file mode 100644 index 0000000..64443a7 --- /dev/null +++ b/src/main/resources/data/futhark/recipes/jaffa_jam_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "item": "futhark:jaffa_jam" + } + }, + "pattern": [ + "##", + "##" + ], + "result": { + "item": "futhark:jaffa_jam_block" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/data/futhark/recipes/jaffa_jam_bottle.json b/src/main/resources/data/futhark/recipes/jaffa_jam_bottle.json new file mode 100644 index 0000000..a54e8c7 --- /dev/null +++ b/src/main/resources/data/futhark/recipes/jaffa_jam_bottle.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "futhark:jaffa_jam_block" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:glass_bottle" + } + ], + "result": { + "count": 4, + "item": "futhark:jaffa_jam" + } +} \ No newline at end of file diff --git a/src/main/resources/data/futhark/recipes/runic_chisel.json b/src/main/resources/data/futhark/recipes/runic_chisel.json new file mode 100644 index 0000000..d345904 --- /dev/null +++ b/src/main/resources/data/futhark/recipes/runic_chisel.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:iron_ingot" + }, + "L": { + "item": "minecraft:lapis_lazuli" + } + }, + "pattern": [ + "X ", + " # ", + " L" + ], + "result": { + "item": "futhark.runic_chisel" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 39af29d..4420eb0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -3,7 +3,7 @@ "id": "futhark", "version": "${version}", "name": "futhark", - "description": "A magic mod inspired by the Bukkit plugin Runecraft", + "description": "A minecraft alpha era inspired mod adding old functionality, nostalgic items, and a magic system inspired by the Bukkit plugin Runecraft", "authors": [ "zongor" ], @@ -26,7 +26,7 @@ "futhark.mixins.json" ], "depends": { - "fabricloader": ">=0.16.0", + "fabricloader": ">=0.15.1", "minecraft": "~1.20.1", "java": ">=17", "fabric-api": "*"