From 9866a9de5e7aad4cd93abd2ba7872c7bb71b94a8 Mon Sep 17 00:00:00 2001 From: Badtz Date: Sun, 15 Oct 2023 13:21:09 -0700 Subject: [PATCH] add charcoal --- src/main/java/me/woach/bone/Bone.java | 9 +++++++++ .../me/woach/bone/blocks/BoneForgeBlock.java | 18 ++++++++++------- .../bone/blockstates/charcoal_block.json | 7 +++++++ .../resources/assets/bone/lang/en_us.json | 1 + .../bone/models/block/charcoal_block.json | 6 ++++++ .../bone/models/item/charcoal_block.json | 3 +++ .../bone/textures/block/charcoal_block.png | Bin 0 -> 4458 bytes .../loot_tables/blocks/charcoal_block.json | 19 ++++++++++++++++++ .../resources/data/bone/recipes/charcoal.json | 12 +++++++++++ .../data/bone/recipes/charcoal_block.json | 16 +++++++++++++++ .../tags/blocks/infiniburn_overworld.json | 6 ++++++ .../tags/blocks/mineable/pickaxe.json | 3 ++- .../tags/blocks/needs_iron_tool.json | 3 ++- 13 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 src/main/resources/assets/bone/blockstates/charcoal_block.json create mode 100644 src/main/resources/assets/bone/models/block/charcoal_block.json create mode 100644 src/main/resources/assets/bone/models/item/charcoal_block.json create mode 100644 src/main/resources/assets/bone/textures/block/charcoal_block.png create mode 100644 src/main/resources/data/bone/loot_tables/blocks/charcoal_block.json create mode 100644 src/main/resources/data/bone/recipes/charcoal.json create mode 100644 src/main/resources/data/bone/recipes/charcoal_block.json create mode 100644 src/main/resources/data/minecraft/tags/blocks/infiniburn_overworld.json 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 0000000000000000000000000000000000000000..90bc9fee916bed05cc292e777807d42d8be693b7 GIT binary patch literal 4458 zcmeHLdr(x@8NW+-Wm_vmqKT+n*CL?ay^nq0vI?@m-oPS3biq!<`&_Q>?p=28va2no z#Ka_;@qt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Wmlv zj4Cx_Y{!M@e`!*v0wxq0FfZl<#S7FzG*JxWnki-H8~nu2;u~B6P){#1C4HymnwD!y z3QP$+on6y%O-X?%fv2*djh&mOJ++j?)w?IU*TcU8gD$KMjl_U#_Ies|{KFTT^;H1AkD^t0}y z!(HpMS?HuMyCC<%k22?Fv%XjU+S_J;PW5f-bHXAaD1>sc^!-AGU7(^m?LF25f>*meJG-sQ%1r|n!NL%3hd^?c?T z>U=cytKSTM@=nLOD|71a`d!DfMh77{U$$?1-R1l!>(b8qY>R0$ ar()TY|2#MQ%bx?4AgZ*=@#e}6&;1)1y#wt4 literal 0 HcmV?d00001 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