diff --git a/src/main/java/com/jenny/compressedblocks/CompressedBlocks.java b/src/main/java/com/jenny/compressedblocks/CompressedBlocks.java index 12504f4..a3363f5 100755 --- a/src/main/java/com/jenny/compressedblocks/CompressedBlocks.java +++ b/src/main/java/com/jenny/compressedblocks/CompressedBlocks.java @@ -1,5 +1,7 @@ package com.jenny.compressedblocks; + +import com.jenny.compressedblocks.Tools; import com.mojang.logging.LogUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.Material; @@ -103,7 +105,7 @@ public class CompressedBlocks public static final RegistryObject GRANITE_4X = BLOCKS.register("granite_4x", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.NONE).strength(5.0F, 11.0F).requiresCorrectToolForDrops())); public static final RegistryObject GRANITE_4X_ITEM = ITEMS.register("granite_4x", () -> new BlockItem(GRANITE_4X.get(), new Item.Properties())); - /* Combined blocks */ + /* COMBINED BLOCKS */ public static final RegistryObject CBLOCK_MINING = BLOCKS.register("cblock_mining", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.NONE).strength(5.0F, 11.0F).requiresCorrectToolForDrops())); public static final RegistryObject CBLOCK_MINING_ITEM = ITEMS.register("cblock_mining", () -> new BlockItem(CBLOCK_MINING.get(), new Item.Properties())); @@ -131,6 +133,7 @@ public class CompressedBlocks output.accept(GRANITE_3X.get()); output.accept(GRANITE_4X.get()); output.accept(CBLOCK_MINING.get()); + output.accept(Tools.ULTRA_PICKAXE.get()); }).build()); public CompressedBlocks() @@ -144,6 +147,7 @@ public class CompressedBlocks BLOCKS.register(modEventBus); // Register the Deferred Register to the mod event bus so items get registered ITEMS.register(modEventBus); + Tools.register(modEventBus); // Register the Deferred Register to the mod event bus so tabs get registered CREATIVE_MODE_TABS.register(modEventBus); diff --git a/src/main/java/com/jenny/compressedblocks/ModItemModelProvider.java b/src/main/java/com/jenny/compressedblocks/ModItemModelProvider.java new file mode 100644 index 0000000..5d926f3 --- /dev/null +++ b/src/main/java/com/jenny/compressedblocks/ModItemModelProvider.java @@ -0,0 +1,67 @@ +package com.jenny.compressedblocks; + +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.client.model.generators.ItemModelBuilder; +import net.minecraftforge.client.model.generators.ItemModelProvider; +import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class ModItemModelProvider extends ItemModelProvider { + public ModItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) { + super(output, CompressedBlocks.MODID, existingFileHelper); + } + + @Override + protected void registerModels() { + handheldItem(Tools.ULTRA_PICKAXE); + } + + private ItemModelBuilder saplingItem(RegistryObject item) { + return withExistingParent(item.getId().getPath(), + new ResourceLocation("item/generated")).texture("layer0", + new ResourceLocation(CompressedBlocks.MODID,"block/" + item.getId().getPath())); + } + + private ItemModelBuilder complexBlock(Block block) { + return withExistingParent(ForgeRegistries.BLOCKS.getKey(block).getPath(), new ResourceLocation(CompressedBlocks.MODID, + "block/" + ForgeRegistries.BLOCKS.getKey(block).getPath())); + } + + public void fenceItem(RegistryObject block, RegistryObject baseBlock) { + this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/fence_inventory")) + .texture("texture", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); + } + + public void wallItem(RegistryObject block, RegistryObject baseBlock) { + this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/wall_inventory")) + .texture("wall", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); + } + + public void buttonItem(RegistryObject block, RegistryObject baseBlock) { + this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/button_inventory")) + .texture("texture", new ResourceLocation(CompressedBlocks.MODID, "block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath())); + } + + + private ItemModelBuilder handheldItem(RegistryObject item) { + return withExistingParent(item.getId().getPath(), + new ResourceLocation("item/handheld")).texture("layer0", + new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); + } + + private ItemModelBuilder simpleBlockItem(RegistryObject item) { + return withExistingParent(item.getId().getPath(), + new ResourceLocation("item/generated")).texture("layer0", + new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); + } + + private ItemModelBuilder simpleItem(RegistryObject item) { + return withExistingParent(item.getId().getPath(), + new ResourceLocation("item/generated")).texture("layer0", + new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath())); + } +} diff --git a/src/main/java/com/jenny/compressedblocks/Tags.java b/src/main/java/com/jenny/compressedblocks/Tags.java new file mode 100644 index 0000000..d24ef98 --- /dev/null +++ b/src/main/java/com/jenny/compressedblocks/Tags.java @@ -0,0 +1,22 @@ +package com.jenny.compressedblocks; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public class Tags { + public static class Blocks { + public static final TagKey NEEDS_ULTRA_TOOL = tag("needs_ultra_tool"); + + private static TagKey tag(String name) { + return BlockTags.create(new ResourceLocation(CompressedBlocks.MODID, name)); + } + } + + public static class Items { + + } +} diff --git a/src/main/java/com/jenny/compressedblocks/ToolTiers.java b/src/main/java/com/jenny/compressedblocks/ToolTiers.java new file mode 100644 index 0000000..6fcf64e --- /dev/null +++ b/src/main/java/com/jenny/compressedblocks/ToolTiers.java @@ -0,0 +1,18 @@ +package com.jenny.compressedblocks; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.Tiers; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.ForgeTier; +import net.minecraftforge.common.TierSortingRegistry; + +import java.util.List; + +public class ToolTiers { + public static final Tier ULTRA = TierSortingRegistry.registerTier( + new ForgeTier(5, 2560, 20f, 4f, 25, + Tags.Blocks.NEEDS_ULTRA_TOOL, () -> Ingredient.of(CompressedBlocks.CBLOCK_MINING_ITEM.get())), + new ResourceLocation(CompressedBlocks.MODID, "ultra"), List.of(Tiers.NETHERITE), List.of() + ); +} diff --git a/src/main/java/com/jenny/compressedblocks/Tools.java b/src/main/java/com/jenny/compressedblocks/Tools.java new file mode 100644 index 0000000..406667c --- /dev/null +++ b/src/main/java/com/jenny/compressedblocks/Tools.java @@ -0,0 +1,20 @@ +package com.jenny.compressedblocks; + +import com.jenny.compressedblocks.ToolTiers; +import net.minecraft.world.item.*; +import net.minecraftforge.common.ForgeSpawnEggItem; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class Tools { + public static final DeferredRegister TOOLS = + DeferredRegister.create(ForgeRegistries.ITEMS, CompressedBlocks.MODID); + + public static final RegistryObject ULTRA_PICKAXE = TOOLS.register("ultra_pickaxe", () -> new PickaxeItem(ToolTiers.ULTRA, 1, -2.5f, new Item.Properties())); + + + + public static void register(IEventBus eventBus) {TOOLS.register(eventBus);}; +} diff --git a/src/main/resources/assets/compressedblocks/lang/en_us.json b/src/main/resources/assets/compressedblocks/lang/en_us.json index cde490b..04cfb15 100644 --- a/src/main/resources/assets/compressedblocks/lang/en_us.json +++ b/src/main/resources/assets/compressedblocks/lang/en_us.json @@ -15,5 +15,6 @@ "block.compressedblocks.granite_2x": "Granite²", "block.compressedblocks.granite_3x": "Granite³", "block.compressedblocks.granite_4x": "Granite⁴", - "block.compressedblocks.cblock_mining": "Mining Block" + "block.compressedblocks.cblock_mining": "Mining Block", + "item.compressedblocks.ultra_pickaxe": "Ultra Pickaxe" } \ No newline at end of file diff --git a/src/main/resources/assets/compressedblocks/models/item/ultra_pickaxe.json b/src/main/resources/assets/compressedblocks/models/item/ultra_pickaxe.json new file mode 100644 index 0000000..6474693 --- /dev/null +++ b/src/main/resources/assets/compressedblocks/models/item/ultra_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "compressedblocks:item/ultra_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png b/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png new file mode 100644 index 0000000..b2cceae Binary files /dev/null and b/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png differ diff --git a/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png.mcmeta b/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png.mcmeta new file mode 100644 index 0000000..d2f0f33 --- /dev/null +++ b/src/main/resources/assets/compressedblocks/textures/item/ultra_pickaxe.png.mcmeta @@ -0,0 +1,7 @@ +{ + "animation": { + "frametime": 4, + "interpolate": true, + "frames": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + } +} \ No newline at end of file diff --git a/src/main/resources/data/compressedblocks/loot_tables/blocks/cblock_mining.json b/src/main/resources/data/compressedblocks/loot_tables/blocks/cblock_mining.json new file mode 100755 index 0000000..9a8f54d --- /dev/null +++ b/src/main/resources/data/compressedblocks/loot_tables/blocks/cblock_mining.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "compressedblocks:cblock_mining" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/compressedblocks/recipes/cblock_mining.json b/src/main/resources/data/compressedblocks/recipes/cblock_mining.json new file mode 100755 index 0000000..0529688 --- /dev/null +++ b/src/main/resources/data/compressedblocks/recipes/cblock_mining.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": + [ + { + "item": "compressedblocks:cobblestone_4x" + }, + { + "item": "compressedblocks:andesite_4x" + }, + { + "item": "compressedblocks:diorite_4x" + }, + { + "item": "compressedblocks:granite_4x" + } + ], + "result": { + "item": "compressedblocks:cblock_mining", + "count": 1 + } +} \ 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 b550bd3..8824062 100755 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -3,6 +3,19 @@ "compressedblocks:cobblestone_1x", "compressedblocks:cobblestone_2x", "compressedblocks:cobblestone_3x", - "compressedblocks:cobblestone_4x" + "compressedblocks:cobblestone_4x", + "compressedblocks:andesite_1x", + "compressedblocks:andesite_2x", + "compressedblocks:andesite_3x", + "compressedblocks:andesite_4x", + "compressedblocks:diorite_1x", + "compressedblocks:diorite_2x", + "compressedblocks:diorite_3x", + "compressedblocks:diorite_4x", + "compressedblocks:granite_1x", + "compressedblocks:granite_2x", + "compressedblocks:granite_3x", + "compressedblocks:granite_4x", + "compressedblocks:cblock_mining" ] } \ No newline at end of file diff --git a/src/main/textures/pickaxe.pxo b/src/main/textures/pickaxe.pxo index da6e900..91c24f8 100644 Binary files a/src/main/textures/pickaxe.pxo and b/src/main/textures/pickaxe.pxo differ