Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

 

 

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"
  }
}

 

  • Author
53 minutes ago, Ugdhar said:

I believe it should be textures.item package, no s at the end.

I tried it, but sadly it's not a solution.

4 hours ago, zenek1290 said:

│       ├── assets
│       │   └── dungeons
│       │       └── models
│       │           └── item
│       │               └── example_item.json
│       ├── assets.dungeons.textures.items
│       │   └── example_item.png

Just to verify, when you put "assets.dungeons.textures.items" here, that's still a nested folder structure like the models, above, yes?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
1 hour ago, zenek1290 said:

Yes, this is nested folder

I was wrong, it was different folder, my error is gone. Thanks for Your support.

  • Author

│       ├── assets

│       │   └── dungeons

│       │       ├── models

│       │       │   └── item

│       │       │       └── example_item.json

│       │       └── textures

│       │           └── item

│       │               └── example_item.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.