add runic chisel, add runic block with placeholder

This commit is contained in:
zongor 2024-11-16 15:21:07 -05:00
parent f7c8c9746e
commit 1106b54082
30 changed files with 293 additions and 19 deletions

View File

@ -1,2 +1,3 @@
# futhark-fabric # futhark-fabric
A minecraft alpha era inspired mod adding old functionality, nostalgic items, and a magic system inspired by the Bukkit plugin Runecraft

View File

@ -6,7 +6,8 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.20.1 minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10 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 Properties
mod_version=0.0.1-1.20.1 mod_version=0.0.1-1.20.1

View File

@ -1,9 +1,15 @@
package com.futhark; package com.futhark;
import com.futhark.block.ModBlocks;
import com.futhark.item.ModItemGroups;
import com.futhark.item.ModItems; import com.futhark.item.ModItems;
import net.fabricmc.api.ModInitializer; 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.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 net.minecraft.util.ActionResult;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -17,7 +23,9 @@ public class Futhark implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
LOGGER.info("Hello from Futhark!"); LOGGER.info("Hello from Futhark!");
ModItems.initialize(); ModItems.init();
ModBlocks.init();
ModItemGroups.init();
UseBlockCallback.EVENT.register(((player, world, hand, hitResult) -> { UseBlockCallback.EVENT.register(((player, world, hand, hitResult) -> {
LOGGER.info(hand.toString()); LOGGER.info(hand.toString());

View File

@ -1,6 +1,8 @@
package com.futhark; package com.futhark;
import net.fabricmc.api.ClientModInitializer; 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{ public class FutharkModClient implements ClientModInitializer{
@Override @Override

View File

@ -1,8 +1,36 @@
package com.futhark.block; 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 class ModBlocks extends Block {
public ModBlocks(Settings settings) { 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());
}
} }

View File

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

View File

@ -1,4 +1,30 @@
package com.futhark.item; 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 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");
}
} }

View File

@ -22,25 +22,48 @@ public class ModItems extends Item {
public static final FoodComponent JAFFA_CAKE_FOOD_COMPONENT = new FoodComponent.Builder() public static final FoodComponent JAFFA_CAKE_FOOD_COMPONENT = new FoodComponent.Builder()
.alwaysEdible() .alwaysEdible()
.snack() .snack()
.hunger(10) .hunger(6)
.saturationModifier(1.5f) .saturationModifier(0.8f)
// The duration is in ticks, 20 ticks = 1 second // The duration is in ticks, 20 ticks = 1 second
.statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 120 * 20, 2), 1.0f) .statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 120 * 20, 2), 1.0f)
.build(); .build();
public static final FoodComponent UNFINISHED_JAFFA_FOOD_COMPONENT = new FoodComponent.Builder()
.snack()
.hunger(1)
.build();
public static final Item JAFFA_CAKE = register( 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); 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"); Futhark.LOGGER.info("Registering Items");
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register((itemGroup) -> itemGroup.add(ModItems.JAFFA_CAKE)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register((itemGroup) -> itemGroup.add(ModItems.JAFFA_CAKE));
CompostingChanceRegistry.INSTANCE.add(ModItems.JAFFA_CAKE, 1.0f); CompostingChanceRegistry.INSTANCE.add(ModItems.JAFFA_CAKE, 1.0f);
FuelRegistry.INSTANCE.add(ModItems.JAFFA_CAKE, 30 * 20); 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));
} }
} }

View File

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

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "futhark:block/jaffa_jam_block"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "futhark:block/rune_block"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,3 +1,11 @@
{ {
"item.futhark.jaffa_cake": "Jaffa Cake" "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"
} }

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "futhark:block/jaffa_jam_block"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "futhark:block/rune_block"
}
}

View File

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

View File

@ -1,6 +1,3 @@
{ {
"parent": "block/cube_all", "parent": "futhark:block/jaffa_jam_block"
"textures": {
"all": "futhark:block/jaffa_jam_block"
}
} }

View File

@ -0,0 +1,3 @@
{
"parent": "futhark:block/rune_block"
}

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
"id": "futhark", "id": "futhark",
"version": "${version}", "version": "${version}",
"name": "futhark", "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": [ "authors": [
"zongor" "zongor"
], ],
@ -26,7 +26,7 @@
"futhark.mixins.json" "futhark.mixins.json"
], ],
"depends": { "depends": {
"fabricloader": ">=0.16.0", "fabricloader": ">=0.15.1",
"minecraft": "~1.20.1", "minecraft": "~1.20.1",
"java": ">=17", "java": ">=17",
"fabric-api": "*" "fabric-api": "*"