Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12.2] Item Description doesn't work


Noob_Master69
 Share

Recommended Posts

Hi, I have created an item for my mod and I have decided to add a description for it.

Here's my code:

package com.galileogalilei.ironmanarmormod.init;

import java.util.ArrayList;
import java.util.List;

import com.galileogalilei.ironmanarmormod.objects.items.ItemBase;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ItemInit 
{
	public static final List<Item> ITEMS = new ArrayList<Item>();
	
	public static Item ARC_REACTOR = new ItemBase("arc_reactor");
	
	public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par2List, boolean par4) {
		Item itemfordesc = null;
		if (itemfordesc == ItemInit.ARC_REACTOR) {
		par2List.add("\u00a7a" + "Proof Tony Stark has a Heart.");
		}
		}
}

But it doesn't seem to work, anyone has any idea why?

Link to comment
Share on other sites

addInformation is a method inside the Item class. It won't magically get called on your ItemInit class. You have to override it in your Item subclass.

 

Secondly:

10 minutes ago, Noob_Master69 said:

Item itemfordesc = null;

if (itemfordesc == ItemInit.ARC_REACTOR) { ... }

This will always be false.

 

Third:

10 minutes ago, Noob_Master69 said:

new ItemBase("arc_reactor");

Don't use ItemBase. There's already a base item class, its called Item.

Edited by Draco18s

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.

Link to comment
Share on other sites

Override Item#addInformation.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.