I just started out with mods, and I was trying to make some basic items. I got the items to load into the game but I cannot figure out what is wrong with the textures and why they are not loading. I checked the folder structure and the contents of the json files more than 5 times and I could not find anything misplaced or mistyped. I would greatly appreciate any help.
Items class
package com.raresamza.firstmod.item;
import com.raresamza.firstmod.FirstMod;
import net.minecraft.world.item.Item;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import static com.raresamza.firstmod.item.ModCustomCreativeTab.*;
public class ModItems {
public static final DeferredRegister<Item> ITEMS=DeferredRegister.create(ForgeRegistries.ITEMS, FirstMod.MOD_ID);
public static final RegistryObject<Item> PLUTONIUM = addToTab(ITEMS.register
("plutonium",
()->new Item(new Item.Properties().stacksTo(32))));
public static final RegistryObject<Item> RAW_PLUTONIUM = addToTab(ITEMS.register
("raw_plutonium",
()->new Item(new Item.Properties().stacksTo(32))));
public static final RegistryObject<Item> ZIRCON = ITEMS.register("zircon",
() -> new Item(new Item.Properties()));
public static final RegistryObject<Item> RAW_ZIRCON = ITEMS.register("raw_zircon",
() -> new Item(new Item.Properties()));
public static void register(IEventBus eventBus) {
ITEMS.register(eventBus);
}
}
Custom creative tab
package com.raresamza.firstmod.item;
import com.raresamza.firstmod.FirstMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.*;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
@Mod.EventBusSubscriber(modid = FirstMod.MOD_ID,bus = Mod.EventBusSubscriber.Bus.MOD,value = Dist.CLIENT)
public class ModCustomCreativeTab {
public static final DeferredRegister<CreativeModeTab> TABS=DeferredRegister.create(Registries.CREATIVE_MODE_TAB, FirstMod.MOD_ID);
public static final List<Supplier<?extends ItemLike>> MOD_TAB_ITEMS=new ArrayList<>();
public static final RegistryObject<CreativeModeTab> SPECIAL_TAB=TABS.register("modtab",
()-> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.modtab"))
.icon(ModItems.PLUTONIUM.get()::getDefaultInstance)
.displayItems((displayParams,output)->
MOD_TAB_ITEMS.forEach(itemLike -> output.accept(itemLike.get())))
.build());
public static <T extends Item> RegistryObject<T> addToTab(RegistryObject<T> itemLike) {
MOD_TAB_ITEMS.add(itemLike);
return itemLike;
}
@SubscribeEvent
public static void buildContents(BuildCreativeModeTabContentsEvent event) {
if(event.getTabKey()== CreativeModeTabs.BUILDING_BLOCKS) {
event.accept(ModItems.PLUTONIUM);
event.accept(ModItems.RAW_PLUTONIUM);
event.accept(ModItems.ZIRCON);
event.accept(ModItems.RAW_ZIRCON);
}
if(event.getTab()==SPECIAL_TAB.get()) {
event.accept(Items.APPLE);
event.accept(ModItems.PLUTONIUM);
event.accept(ModItems.RAW_PLUTONIUM);
event.accept(ModItems.ZIRCON);
event.accept(ModItems.RAW_ZIRCON);
}
}
}
raw_plutonium.json
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "firstmod:item/raw_plutonium"
}
}
plutonium.json
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "firstmod:item/plutonium"
}
}
I would like to include a screenshot of the resource folder structure in case I might have somehow misplaced something but I couldn't find how to paste the image. Also, I have read other threads on this but it did not help, couldn't find anything wrong with my code.