Hi Guys, I recently started making minecraft mods and came up to my first problem that I cannot resolve...
Problem is with loading texture of an item to the game.
Here is my code and file tree.
File Tree
.
├── main
│ ├── java
│ │ └── com
│ │ └── zenek1290
│ │ ├── Dungeons.java
│ │ └── ModEventSubscriber.java
│ └── resources
│ ├── META-INF
│ │ └── mods.toml
│ ├── assets
│ │ └── dungeons
│ │ └── models
│ │ └── item
│ │ └── example_item.json
│ ├── assets.dungeons.textures.items
│ │ └── example_item.png
│ └── pack.mcmeta
└── test
├── java
└── resources
ModEventSubscriber.java
package com.zenek1290;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistryEntry;
@Mod.EventBusSubscriber(modid = Dungeons.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ModEventSubscriber {
@SubscribeEvent
public static void onRegisterItem(RegistryEvent.Register<Item> event) {
event.getRegistry().registerAll(
setup(new Item(new Item.Properties()), "example_item")
);
}
public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final String name) {
return setup(entry, new ResourceLocation(Dungeons.MODID, name));
}
public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final ResourceLocation registryName) {
entry.setRegistryName(registryName);
return entry;
}
}
example_item.json
{
"parent": "item/generated",
"textures": {
"layer0": "dungeons:items/example_item"
}
}