This commit is contained in:
2024-12-30 16:15:57 -06:00
parent 189eb3ceeb
commit 44f223db4f
18 changed files with 709 additions and 522 deletions

View File

@@ -4,10 +4,12 @@ import xyz.sillyangel.nugget.NuggetMod;
import xyz.sillyangel.nugget.block.ModBlocks;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.tags.BlockTags;
import net.minecraftforge.common.data.BlockTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;
import xyz.sillyangel.nugget.util.ModTags;
import java.util.concurrent.CompletableFuture;
@@ -24,10 +26,17 @@ public class ModBlockTagProvider extends BlockTagsProvider {
.add(ModBlocks.NUGGET_ORE.get())
.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
tag(BlockTags.NEEDS_IRON_TOOL)
.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
tag(BlockTags.NEEDS_DIAMOND_TOOL)
tag(BlockTags.NEEDS_STONE_TOOL)
.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get())
.add(ModBlocks.RAW_NUGGET_BLOCK.get());
// tag(BlockTags.NEEDS_STONE_TOOL)
tag(ModTags.Blocks.NEEDS_NUGGET_TOOL)
.add(ModBlocks.RAW_NUGGET_BLOCK.get())
.addTag(BlockTags.NEEDS_DIAMOND_TOOL);
tag(ModTags.Blocks.INCORRECT_FOR_NUGGET_TOOL)
.addTag(BlockTags.INCORRECT_FOR_DIAMOND_TOOL)
.remove(ModTags.Blocks.NEEDS_NUGGET_TOOL);
}
}

View File

@@ -3,8 +3,14 @@ package xyz.sillyangel.nugget.datagen;
import xyz.sillyangel.nugget.NuggetMod;
import xyz.sillyangel.nugget.item.ModItems;
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) {
@@ -15,5 +21,41 @@ public class ModItemModelProvider extends ItemModelProvider {
protected void registerModels() {
basicItem(ModItems.NUGGET.get());
basicItem(ModItems.RAW_NUGGET.get());
handheldItem(ModItems.NUGGET_SWORD);
handheldItem(ModItems.NUGGET_PICKAXE);
handheldItem(ModItems.NUGGET_SHOVEL);
handheldItem(ModItems.NUGGET_AXE);
handheldItem(ModItems.NUGGET_HOE);
}
private ItemModelBuilder handheldItem(RegistryObject<Item> item) {
return withExistingParent(item.getId().getPath(),
ResourceLocation.parse("item/handheld")).texture("layer0",
ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID,"item/" + item.getId().getPath()));
}
public void buttonItem(RegistryObject<? extends Block> block, RegistryObject<Block> baseBlock) {
this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/button_inventory"))
.texture("texture", ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID,
"block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath()));
}
public void fenceItem(RegistryObject<? extends Block> block, RegistryObject<Block> baseBlock) {
this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/fence_inventory"))
.texture("texture", ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID,
"block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath()));
}
public void wallItem(RegistryObject<? extends Block> block, RegistryObject<Block> baseBlock) {
this.withExistingParent(ForgeRegistries.BLOCKS.getKey(block.get()).getPath(), mcLoc("block/wall_inventory"))
.texture("wall", ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID,
"block/" + ForgeRegistries.BLOCKS.getKey(baseBlock.get()).getPath()));
}
private ItemModelBuilder simpleBlockItem(RegistryObject<? extends Block> item) {
return withExistingParent(item.getId().getPath(),
ResourceLocation.parse("item/generated")).texture("layer0",
ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID,"item/" + item.getId().getPath()));
}
}

View File

@@ -34,8 +34,24 @@ public class ModRecipeProvider extends RecipeProvider implements IConditionBuild
.requires(ModBlocks.NUGGET_BLOCK.get())
.unlockedBy(getHasName(ModBlocks.NUGGET_BLOCK.get()), has(ModBlocks.NUGGET_BLOCK.get())).save(pRecipeOutput);
// RAW NUGGET
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
.pattern("AAA")
.pattern("AAA")
.pattern("AAA")
.define('A', ModItems.RAW_NUGGET.get())
.unlockedBy(getHasName(ModItems.RAW_NUGGET.get()), has(ModItems.RAW_NUGGET.get())).save(pRecipeOutput);
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.requires(ModBlocks.RAW_NUGGET_BLOCK.get())
.unlockedBy(getHasName(ModBlocks.RAW_NUGGET_BLOCK.get()), has(ModBlocks.RAW_NUGGET_BLOCK.get())).save(pRecipeOutput);
oreSmelting(pRecipeOutput, NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
oreBlasting(pRecipeOutput, NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
}
protected static void oreSmelting(RecipeOutput recipeOutput, List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult,

View File

@@ -21,6 +21,12 @@ public class ModCreativeModeTabs {
output.accept(ModItems.NUGGET.get());
output.accept(ModItems.RAW_NUGGET.get());
output.accept(ModItems.NUGGET_SWORD.get());
output.accept(ModItems.NUGGET_PICKAXE.get());
output.accept(ModItems.NUGGET_SHOVEL.get());
output.accept(ModItems.NUGGET_AXE.get());
output.accept(ModItems.NUGGET_HOE.get());
}).build());
public static final RegistryObject<CreativeModeTab> NUGGET_BLOCKS_TAB = CREATIVE_MODE_TABS.register("nuggetmod_blocks_tab",

View File

@@ -1,15 +1,12 @@
package xyz.sillyangel.nugget.item;
import xyz.sillyangel.nugget.NuggetMod;
import net.minecraft.world.item.Item;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.network.chat.Component;
import net.minecraftforge.registries.RegistryObject;
import net.minecraft.world.item.*;
import java.util.List;
public class ModItems {
@@ -28,7 +25,21 @@ public class ModItems {
public static final RegistryObject<Item> RAW_NUGGET = ITEMS.register("raw_nugget",
() -> new Item(new Item.Properties()));
public static final RegistryObject<Item> NUGGET_SWORD = ITEMS.register("nugget_sword",
() -> new SwordItem(ModToolTiers.NUGGET, new Item.Properties()
.attributes(SwordItem.createAttributes(ModToolTiers.NUGGET, 3, -2.4f))));
public static final RegistryObject<Item> NUGGET_PICKAXE = ITEMS.register("nugget_pickaxe",
() -> new PickaxeItem(ModToolTiers.NUGGET, new Item.Properties()
.attributes(PickaxeItem.createAttributes(ModToolTiers.NUGGET, 1, -2.8f))));
public static final RegistryObject<Item> NUGGET_SHOVEL = ITEMS.register("nugget_shovel",
() -> new ShovelItem(ModToolTiers.NUGGET, new Item.Properties()
.attributes(ShovelItem.createAttributes(ModToolTiers.NUGGET, 1.5f, -3.0f))));
public static final RegistryObject<Item> NUGGET_AXE = ITEMS.register("nugget_axe",
() -> new AxeItem(ModToolTiers.NUGGET, new Item.Properties()
.attributes(AxeItem.createAttributes(ModToolTiers.NUGGET, 6, -3.2f))));
public static final RegistryObject<Item> NUGGET_HOE = ITEMS.register("nugget_hoe",
() -> new HoeItem(ModToolTiers.NUGGET, new Item.Properties()
.attributes(HoeItem.createAttributes(ModToolTiers.NUGGET, 0, -3.0f))));
public static void register(IEventBus eventBus) {
ITEMS.register(eventBus);

View File

@@ -0,0 +1,12 @@
package xyz.sillyangel.nugget.item;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.ForgeTier;
import xyz.sillyangel.nugget.util.ModTags;
public class ModToolTiers {
public static final Tier NUGGET = new ForgeTier(1500, 4.5f, 3.5f, 25,
ModTags.Blocks.NEEDS_NUGGET_TOOL, () -> Ingredient.of(ModItems.NUGGET.get()),
ModTags.Blocks.INCORRECT_FOR_NUGGET_TOOL);
}

View File

@@ -10,6 +10,8 @@ import net.minecraft.world.level.block.Block;
public class ModTags {
public static class Blocks {
public static final TagKey<Block> NEEDS_NUGGET_TOOL = createTag("needs_nugget_tool");
public static final TagKey<Block> INCORRECT_FOR_NUGGET_TOOL = createTag("incorrect_for_nugget_tool");
private static TagKey<Block> createTag(String name) {
return BlockTags.create(ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID, name));