diff --git a/src/main/java/me/woach/bone/Bone.java b/src/main/java/me/woach/bone/Bone.java index de79911..d8bdb8d 100644 --- a/src/main/java/me/woach/bone/Bone.java +++ b/src/main/java/me/woach/bone/Bone.java @@ -21,7 +21,9 @@ import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; @@ -32,6 +34,7 @@ import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.tag.TagKey; +import net.minecraft.sound.BlockSoundGroup; import net.minecraft.text.Text; import net.minecraft.util.Identifier; @@ -52,6 +55,8 @@ public static Identifier getId(String path) { public static final BoneForgeBlock BONE_FORGE_BLOCK = new BoneForgeBlock(); public static final BoneFireBlock BONE_FIRE_BLOCK = new BoneFireBlock(); + public static final Block CHARCOAL_BLOCK = new Block(FabricBlockSettings.create().requiresTool() + .strength(3.0f).sounds(BlockSoundGroup.STONE).burnable()); public static final BlockEntityType BONE_FORGE_BLOCK_ENTITY = Registry.register( Registries.BLOCK_ENTITY_TYPE, @@ -72,6 +77,7 @@ public void onInitialize() { Registry.register(Registries.ITEM_GROUP, getId("bone"), ITEM_GROUP.entries((context, entries) -> { entries.add(BONE_ITEM); entries.add(BONE_FORGE_BLOCK); + entries.add(CHARCOAL_BLOCK); for (AbstractItemRegistry ItemRegistry : ITEM_REGISTRIES) { for (Item item : ItemRegistry.getItems()) { entries.add(item); @@ -83,6 +89,9 @@ public void onInitialize() { Registry.register(Registries.ITEM, getId("bone_forge"), new BlockItem(BONE_FORGE_BLOCK, new FabricItemSettings())); Registry.register(Registries.BLOCK, getId("bone_fire"), BONE_FIRE_BLOCK); + Registry.register(Registries.BLOCK, getId("charcoal_block"), CHARCOAL_BLOCK); + Registry.register(Registries.ITEM, getId("charcoal_block"), + new BlockItem(CHARCOAL_BLOCK, new FabricItemSettings())); Registry.register(Registries.ITEM, getId("bone_fire"), new BlockItem(BONE_FIRE_BLOCK, new FabricItemSettings())); Registry.register(Registries.ITEM, getId("bone"), BONE_ITEM); diff --git a/src/main/java/me/woach/bone/blocks/BoneForgeBlock.java b/src/main/java/me/woach/bone/blocks/BoneForgeBlock.java index 4fcc8a6..fe5aff0 100644 --- a/src/main/java/me/woach/bone/blocks/BoneForgeBlock.java +++ b/src/main/java/me/woach/bone/blocks/BoneForgeBlock.java @@ -24,33 +24,37 @@ public BoneForgeBlock() { super(FabricBlockSettings.create().pistonBehavior(PistonBehavior.BLOCK).strength(4.0f).requiresTool() .luminance(8).sounds(BlockSoundGroup.STONE)); } + @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { return VoxelShapes.union( VoxelShapes.cuboid(0.00f, 0.375f, 0.00f, 1.00f, 0.75f, 1.00f)); } -// public static boolean isAlit(WorldAccess world, BlockPos pos) { -// BlockPos below = pos.down(); -// } + // public static boolean isAlit(WorldAccess world, BlockPos pos) { + // BlockPos below = pos.down(); + // } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (world.isClient) return ActionResult.SUCCESS; + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { + if (world.isClient) + return ActionResult.SUCCESS; BoneForgeBlockEntity blockEntity = (BoneForgeBlockEntity) world.getBlockEntity(pos); assert blockEntity != null; ItemStack playersItem = player.getStackInHand(hand); if (!playersItem.isEmpty()) { // Try to put tool into forge - if(blockEntity.isBoneforgable(playersItem) && blockEntity.getStack(BoneForgeBlockEntity.TOOL_SLOT).isEmpty()) { + if (blockEntity.isBoneforgable(playersItem) + && blockEntity.getStack(BoneForgeBlockEntity.TOOL_SLOT).isEmpty()) { blockEntity.setStack(BoneForgeBlockEntity.TOOL_SLOT, playersItem.copy()); playersItem.setCount(0); return ActionResult.SUCCESS; } // Try to put bone into forge - if(blockEntity.isBone(playersItem) && blockEntity.getStack(BoneForgeBlockEntity.BONE_SLOT).isEmpty()) { + if (blockEntity.isBone(playersItem) && blockEntity.getStack(BoneForgeBlockEntity.BONE_SLOT).isEmpty()) { blockEntity.setStack(BoneForgeBlockEntity.BONE_SLOT, playersItem.copyWithCount(1)); if (!player.getAbilities().creativeMode) { playersItem.decrement(1); diff --git a/src/main/resources/assets/bone/blockstates/charcoal_block.json b/src/main/resources/assets/bone/blockstates/charcoal_block.json new file mode 100644 index 0000000..a8eda14 --- /dev/null +++ b/src/main/resources/assets/bone/blockstates/charcoal_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "bone:block/charcoal_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bone/lang/en_us.json b/src/main/resources/assets/bone/lang/en_us.json index 330a5d4..ed1f540 100644 --- a/src/main/resources/assets/bone/lang/en_us.json +++ b/src/main/resources/assets/bone/lang/en_us.json @@ -1,5 +1,6 @@ { "block.bone.bone_forge": "Bone Forge", + "block.bone.charcoal_block": "Block of Charcoal", "block.bone.bone_fire": "Bone Fire", "block.bone.bone_fire.type=jord": "Jord Fire", "block.bone.bone_fire.type=aegir": "Aegir Fire", diff --git a/src/main/resources/assets/bone/models/block/charcoal_block.json b/src/main/resources/assets/bone/models/block/charcoal_block.json new file mode 100644 index 0000000..01c10e7 --- /dev/null +++ b/src/main/resources/assets/bone/models/block/charcoal_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "bone:block/charcoal_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bone/models/item/charcoal_block.json b/src/main/resources/assets/bone/models/item/charcoal_block.json new file mode 100644 index 0000000..e1283bb --- /dev/null +++ b/src/main/resources/assets/bone/models/item/charcoal_block.json @@ -0,0 +1,3 @@ +{ + "parent": "bone:block/charcoal_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/bone/textures/block/charcoal_block.png b/src/main/resources/assets/bone/textures/block/charcoal_block.png new file mode 100644 index 0000000..90bc9fe Binary files /dev/null and b/src/main/resources/assets/bone/textures/block/charcoal_block.png differ diff --git a/src/main/resources/data/bone/loot_tables/blocks/charcoal_block.json b/src/main/resources/data/bone/loot_tables/blocks/charcoal_block.json new file mode 100644 index 0000000..7cf7162 --- /dev/null +++ b/src/main/resources/data/bone/loot_tables/blocks/charcoal_block.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "bone:charcoal_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/bone/recipes/charcoal.json b/src/main/resources/data/bone/recipes/charcoal.json new file mode 100644 index 0000000..e91ba53 --- /dev/null +++ b/src/main/resources/data/bone/recipes/charcoal.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "bone:charcoal_block" + } + ], + "result": { + "item": "minecraft:charcoal", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/bone/recipes/charcoal_block.json b/src/main/resources/data/bone/recipes/charcoal_block.json new file mode 100644 index 0000000..6977f7e --- /dev/null +++ b/src/main/resources/data/bone/recipes/charcoal_block.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "###", + "###", + "###" + ], + "key": { + "#": { + "item": "minecraft:charcoal" + } + }, + "result": { + "item": "bone:charcoal_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/infiniburn_overworld.json b/src/main/resources/data/minecraft/tags/blocks/infiniburn_overworld.json new file mode 100644 index 0000000..4629455 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/infiniburn_overworld.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "bone:charcoal_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index dfaec6e..2f2e5e6 100644 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "bone:bone_forge" + "bone:bone_forge", + "bone:charcoal_block" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json index dfaec6e..2f2e5e6 100644 --- a/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json +++ b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "bone:bone_forge" + "bone:bone_forge", + "bone:charcoal_block" ] } \ No newline at end of file