Jump to content

Recommended Posts

Posted

We need more info to help: where did you place the texture file, what have you tried, are there any errors? Is the problem that the item is black-pink checkered, meaning the texture is missing, or something else?

Posted

You need a new "items" folder at 

resources/assets/yourmodid/

there you add for every item model a .json file with the exact item/block name and fill it like this if it's an item:

{
  "model": {
    "type": "minecraft:model",
    "model": "yourmodid:item/youritem"
  }
}

and so if its a block:

{
  "model": {
    "type": "minecraft:model",
    "model": "yourmodid:block/youritem"
  }
}

There is also a generator for it you can do namy crazy things with it which replaces the previous hard coded Item Properties implementaion method (Bow pulling animation for example). https://misode.github.io/assets/item/

Posted (edited)

Hey! I noticed you're trying to register your alexandrite item and possibly set its resource location manually with setId(...). I wanted to help clarify a few things that might simplify your code and avoid errors.

The issue:

You're using setId(...) inside the item registration like this:

 

public static final RegistryObject<Item> ALEXANDRITE = ITEMS.register("alexandrite", () -> new Item(new Item.Properties().useItemDescriptionPrefix() .setId(ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(TutorialMod.MOD_ID, "alexandrite")))));

But:

Item.Properties does not have a setId(...) method — this line will either fail or do nothing meaningful.

useItemDescriptionPrefix() is mostly used for translation keys (like "item.modid.name") but isn't needed unless you have a very specific reason.

🛠 The fix:

You only need to register your item like this:

 

public static final RegistryObject<Item> ALEXANDRITE = ITEMS.register("alexandrite", () -> new Item(new Item.Properties()));

Forge automatically handles the ResourceLocation (modid:alexandrite) based on the name passed into .register(...), so there’s no need to manually assign it.

📝 For the texture:

Make sure you have this file in your resources:

src/main/resources/assets/tutorialmod/models/item/alexandrite.json

{ "parent": "item/generated", "textures": { "layer0": "tutorialmod:item/alexandrite" } }

And your texture PNG goes here:

src/main/resources/assets/tutorialmod/textures/item/alexandrite.png

🌍 For the name in-game:

Add this to your en_us.json under:

src/main/resources/assets/tutorialmod/lang/en_us.json

{ "item.tutorialmod.alexandrite": "Alexandrite" }

 

Note: if im wrong about the issues you are encountering, i apologize.

Edited by Loghan

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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