added UltraPickaxe

This commit is contained in:
Jenny 2024-12-31 05:14:38 +01:00
parent dd0d538afb
commit cfeed04a0a
Signed by: Jenny
GPG Key ID: 2072A14E40940632
13 changed files with 197 additions and 3 deletions

View File

@ -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<Block> GRANITE_4X = BLOCKS.register("granite_4x", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.NONE).strength(5.0F, 11.0F).requiresCorrectToolForDrops()));
public static final RegistryObject<Item> GRANITE_4X_ITEM = ITEMS.register("granite_4x", () -> new BlockItem(GRANITE_4X.get(), new Item.Properties()));
/* Combined blocks */
/* COMBINED BLOCKS */
public static final RegistryObject<Block> CBLOCK_MINING = BLOCKS.register("cblock_mining", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.NONE).strength(5.0F, 11.0F).requiresCorrectToolForDrops()));
public static final RegistryObject<Item> 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);

View File

@ -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<Block> 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> block, RegistryObject<Block> 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> block, RegistryObject<Block> 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> block, RegistryObject<Block> 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> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/handheld")).texture("layer0",
new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath()));
}
private ItemModelBuilder simpleBlockItem(RegistryObject<Block> 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> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/generated")).texture("layer0",
new ResourceLocation(CompressedBlocks.MODID,"item/" + item.getId().getPath()));
}
}

View File

@ -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<Block> NEEDS_ULTRA_TOOL = tag("needs_ultra_tool");
private static TagKey<Block> tag(String name) {
return BlockTags.create(new ResourceLocation(CompressedBlocks.MODID, name));
}
}
public static class Items {
}
}

View File

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

View File

@ -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<Item> TOOLS =
DeferredRegister.create(ForgeRegistries.ITEMS, CompressedBlocks.MODID);
public static final RegistryObject<Item> 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);};
}

View File

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

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "compressedblocks:item/ultra_pickaxe"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

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

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "compressedblocks:cblock_mining"
}
]
}
]
}

View File

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

View File

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

Binary file not shown.