Add Nugget Mod items, blocks, and recipes

This commit is contained in:
2024-12-15 19:00:19 -06:00
parent bb8c8a2594
commit ab3d75abcf
28 changed files with 364 additions and 10 deletions

View File

@@ -15,6 +15,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
import xyz.sillyangel.nugget.item.ModCreativeModeTabs;
import xyz.sillyangel.nugget.item.ModItems;
import xyz.sillyangel.nugget.block.ModBlocks;
@@ -33,6 +34,8 @@ public class NuggetMod {
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
ModCreativeModeTabs.register(modEventBus);
ModItems.register(modEventBus);
ModBlocks.register(modEventBus);
@@ -48,13 +51,7 @@ public class NuggetMod {
// Add the example block item to the building blocks tab
private void addCreative(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) {
event.accept(ModItems.NUGGET);
}
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) {
event.accept(ModBlocks.NUGGET_BLOCK);
event.accept(ModBlocks.RAW_NUGGET_BLOCK);
}
}
// You can use SubscribeEvent and let the Event Bus discover methods to call

View File

@@ -2,9 +2,11 @@ package xyz.sillyangel.nugget.block;
import xyz.sillyangel.nugget.NuggetMod;
import xyz.sillyangel.nugget.item.ModItems;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.eventbus.api.IEventBus;
@@ -25,8 +27,16 @@ public class ModBlocks {
public static final RegistryObject<Block> RAW_NUGGET_BLOCK = registerBlock("raw_nugget_block",
() -> new Block(BlockBehaviour.Properties.of()
.strength(3f).requiresCorrectToolForDrops()));
private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) {
// ores
public static final RegistryObject<Block> NUGGET_ORE = registerBlock("nugget_ore",
() -> new DropExperienceBlock(UniformInt.of(2, 4), BlockBehaviour.Properties.of()
.strength(4f).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> NUGGET_DEEPSLATE_ORE = registerBlock("nugget_deepslate_ore",
() -> new DropExperienceBlock(UniformInt.of(2, 4), BlockBehaviour.Properties.of()
.strength(5f).requiresCorrectToolForDrops().sound(SoundType.DEEPSLATE)));
private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) {
RegistryObject<T> toReturn = BLOCKS.register(name, block);
registerBlockItem(name, toReturn);
return toReturn;

View File

@@ -1,4 +1,43 @@
package xyz.sillyangel.nugget.item;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import xyz.sillyangel.nugget.NuggetMod;
import xyz.sillyangel.nugget.block.ModBlocks;
public class ModCreativeModeTabs {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, NuggetMod.MOD_ID);
public static final RegistryObject<CreativeModeTab> NUGGET_ITEMS_TAB = CREATIVE_MODE_TABS.register("nuggetmod_items_tab",
() -> CreativeModeTab.builder().icon(() -> new ItemStack(ModItems.NUGGET.get()))
.title(Component.translatable("creativetab.nuggetmod.nugget_items"))
.displayItems((itemDisplayParameters, output) -> {
output.accept(ModItems.NUGGET.get());
output.accept(ModItems.RAW_NUGGET.get());
}).build());
public static final RegistryObject<CreativeModeTab> NUGGET_BLOCKS_TAB = CREATIVE_MODE_TABS.register("nuggetmod_blocks_tab",
() -> CreativeModeTab.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.withTabsBefore(NUGGET_ITEMS_TAB.getId())
.title(Component.translatable("creativetab.nuggetmod.nugget_blocks"))
.displayItems((itemDisplayParameters, output) -> {
output.accept(ModBlocks.NUGGET_BLOCK.get());
output.accept(ModBlocks.RAW_NUGGET_BLOCK.get());
output.accept(ModBlocks.NUGGET_ORE.get());
output.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build());
public static void register(IEventBus eventBus) {
CREATIVE_MODE_TABS.register(eventBus);
}
}

View File

@@ -14,6 +14,9 @@ public class ModItems {
public static final RegistryObject<Item> NUGGET = ITEMS.register("nugget",
() -> new Item(new Item.Properties()));
public static final RegistryObject<Item> RAW_NUGGET = ITEMS.register("raw_nugget",
() -> new Item(new Item.Properties()));
public static void register(IEventBus eventBus) {

View File

@@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "nuggetmod:block/nugget_deepslate_ore" }
}
}

View File

@@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "nuggetmod:block/nugget_ore" }
}
}

View File

@@ -1,5 +1,12 @@
{
"item.nuggetmod.raw_nugget": "Raw Nugget",
"item.nuggetmod.nugget": "nugget",
"block.nuggetmod.nugget_block": "Nugget Block",
"block.nuggetmod.raw_nugget_block": "Raw Nugget Block"
"block.nuggetmod.raw_nugget_block": "Raw Nugget Block",
"block.nuggetmod.nugget_ore": "Nugget Ore",
"block.nuggetmod.nugget_deepslate_ore": "Nugget Deepslate Ore",
"creativetab.nuggetmod.nugget_items": "Nugget Mod Items",
"creativetab.nuggetmod.nugget_blocks": "Nugget Mod Blocks"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "nuggetmod:block/nugget_deepslate_ore"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "nuggetmod:block/nugget_ore"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "nuggetmod:block/nugget_deepslate_ore"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "nuggetmod:block/nugget_ore"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "nuggetmod:item/raw_nugget"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"nuggetmod:nugget_block",
"nuggetmod:raw_nugget_block",
"nuggetmod:nugget_ore",
"nuggetmod:nugget_deepslate_ore"
]
}

View File

@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"nuggetmod:nugget_deepslate_ore"
]
}

View File

@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"nuggetmod:nugget_block",
"nuggetmod:raw_nugget_block",
"nuggetmod:nugget_ore"
]
}

View File

@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "nuggetmod:nugget_block"
}
],
"rolls": 1.0
}
],
"random_sequence": "nuggetmod:blocks/nugget_block"
}

View File

@@ -0,0 +1,61 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"predicates": {
"minecraft:enchantments": [
{
"enchantments": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
}
],
"name": "nuggetmod:nugget_deepslate_ore"
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 5.0,
"min": 2.0
},
"function": "minecraft:set_count"
},
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops",
"function": "minecraft:apply_bonus"
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "nuggetmod:raw_nugget"
}
]
}
],
"rolls": 1.0
}
],
"random_sequence": "nuggetmod:blocks/nugget_deepslate_ore"
}

View File

@@ -0,0 +1,52 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"predicates": {
"minecraft:enchantments": [
{
"enchantments": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
}
],
"name": "nuggetmod:nugget_ore"
},
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops",
"function": "minecraft:apply_bonus"
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "nuggetmod:raw_nugget"
}
]
}
],
"rolls": 1.0
}
],
"random_sequence": "nuggetmod:blocks/nugget_ore"
}

View File

@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "nuggetmod:raw_nugget_block"
}
],
"rolls": 1.0
}
],
"random_sequence": "nuggetmod:blocks/raw_nugget_block"
}

View File

@@ -0,0 +1,13 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "nuggetmod:nugget_block"
}
],
"result": {
"count": 9,
"id": "nuggetmod:nugget"
}
}

View File

@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"A": {
"item": "nuggetmod:nugget"
}
},
"pattern": [
"AAA",
"AAA",
"AAA"
],
"result": {
"count": 1,
"id": "nuggetmod:nugget_block"
}
}

View File

@@ -0,0 +1,12 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 100,
"experience": 0.50,
"ingredient": {
"item": "nuggetmod:raw_nugget"
},
"result": {
"id": "nuggetmod:nugget"
}
}

View File

@@ -0,0 +1,12 @@
{
"type": "minecraft:smelting",
"category": "misc",
"cookingtime": 200,
"experience": 0.35,
"ingredient": {
"item": "nuggetmod:raw_nugget"
},
"result": {
"id": "nuggetmod:nugget"
}
}

View File

@@ -0,0 +1,13 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "nuggetmod:raw_nugget_block"
}
],
"result": {
"count": 9,
"id": "nuggetmod:raw_nugget"
}
}

View File

@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"A": {
"item": "nuggetmod:raw_nugget"
}
},
"pattern": [
"AAA",
"AAA",
"AAA"
],
"result": {
"count": 1,
"id": "nuggetmod:raw_nugget_block"
}
}