before minecraftupdate

This commit is contained in:
2025-01-04 15:53:11 -06:00
parent 22d7ee7d94
commit 583a0a5bd1
37 changed files with 624 additions and 510 deletions

View File

@@ -17,6 +17,7 @@ import org.slf4j.Logger;
import xyz.sillyangel.nugget.item.ModCreativeModeTabs;
import xyz.sillyangel.nugget.item.ModItems;
import xyz.sillyangel.nugget.block.ModBlocks;
import xyz.sillyangel.nugget.sound.ModSounds;
// Very important Comment
// The value here should match an entry in the META-INF/mods.toml file
@@ -38,6 +39,8 @@ public class NuggetMod {
ModItems.register(modEventBus);
ModBlocks.register(modEventBus);
ModSounds.register(modEventBus);
// Register the item to a creative tab
modEventBus.addListener(this::addCreative);
// Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us

View File

@@ -45,6 +45,7 @@ public class ModItemModelProvider extends ItemModelProvider {
basicItem(ModItems.NUGGET_SMITHING_TEMPLATE.get());
basicItem(ModItems.NUGGET.get());
basicItem(ModItems.RAW_NUGGET.get());
basicItem(ModItems.NUGGET_MUSIC_DISC.get());
handheldItem(ModItems.NUGGET_SWORD);
handheldItem(ModItems.NUGGET_PICKAXE);

View File

@@ -35,6 +35,8 @@ public class ModCreativeModeTabs {
output.accept(ModItems.NUGGET_HORSE_ARMOR.get());
output.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get());
output.accept(ModItems.NUGGET_MUSIC_DISC.get());
}).build());
public static final RegistryObject<CreativeModeTab> NUGGET_BLOCKS_TAB = CREATIVE_MODE_TABS.register("nuggetmod_blocks_tab",

View File

@@ -8,6 +8,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.registries.RegistryObject;
import net.minecraft.world.item.*;
import xyz.sillyangel.nugget.sound.ModSounds;
import java.util.List;
public class ModItems {
@@ -63,6 +65,11 @@ public class ModItems {
// smithing temp
public static final RegistryObject<Item> NUGGET_SMITHING_TEMPLATE = ITEMS.register("nugget_armor_trim_smithing_template",
() -> SmithingTemplateItem.createArmorTrimTemplate(ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_trim_mat")));
public static final RegistryObject<Item> NUGGET_MUSIC_DISC = ITEMS.register("nugget_music_disc",
() -> new Item(new Item.Properties().jukeboxPlayable(ModSounds.NUGGET_THEME_KEY).stacksTo(1)));
public static void register(IEventBus eventBus) {
ITEMS.register(eventBus);
}

View File

@@ -0,0 +1,31 @@
package xyz.sillyangel.nugget.sound;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.JukeboxSong;
import xyz.sillyangel.nugget.NuggetMod;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModSounds {
public static final DeferredRegister<SoundEvent> SOUND_EVENT =
DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, NuggetMod.MOD_ID);
public static final RegistryObject<SoundEvent> NUGGET_THEME = registerSoundEvent("nugget_theme");
public static final ResourceKey<JukeboxSong> NUGGET_THEME_KEY = ResourceKey.create(Registries.JUKEBOX_SONG,
ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_theme"));
private static RegistryObject<SoundEvent> registerSoundEvent(String name) {
return SOUND_EVENT.register(name, () -> SoundEvent.createVariableRangeEvent(ResourceLocation.fromNamespaceAndPath(NuggetMod.MOD_ID, name)));
}
public static void register(IEventBus eventBus) {
SOUND_EVENT.register(eventBus);
}
}