Jump to content

Recommended Posts

Posted

Okay so I'm trying to get a tool tip on individual items that are linked to the same class, I've tried this:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		list.add("");
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

And this:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	else if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		return;
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

And this...:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	else if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		list.add("");
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

But obviously they aren't working or I wouldn't be asking for help, so yeah does anyone know what I need to do to fix this? And could you tell me out of the three attempts which is closest? Thanks. :)

Posted

Okay so I'm trying to get a tool tip on individual items that are linked to the same class, I've tried this:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		list.add("");
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

And this:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	else if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		return;
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

And this...:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;

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

public class MAItem extends Item {
public MAItem(String name) {
	super();

	this.setUnlocalizedName(name);
	this.setCreativeTab(MAGlobal.maCreativeTabItems);
}

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4){
	if (this == MAItems.ArrowMould) {
		list.add("Arrow Mould Text");
	}
	else if(this == MAItems.BananaSeeds) {
		list.add("Banana Seed Text");
	}
	else {
		list.add("");
	}
}
{

}
/**
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("Example");
}*/
}

 

But obviously they aren't working or I wouldn't be asking for help, so yeah does anyone know what I need to do to fix this? And could you tell me out of the three attempts which is closest? Thanks. :)

Posted

Attempts #1 and #3 look identical to me.

 

By the way, you have an empty block:

	{

}

You can remove that.

 

As for the desired behavior:

obviously they aren't working

Define "not working."  What is it that the code does that you don't want or what is it that the code isn't doing that you do want?

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.

Posted

Attempts #1 and #3 look identical to me.

 

By the way, you have an empty block:

	{

}

You can remove that.

 

As for the desired behavior:

obviously they aren't working

Define "not working."  What is it that the code does that you don't want or what is it that the code isn't doing that you do want?

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.

Posted

Attempts #1 and #3 look identical to me.

 

By the way, you have an empty block:

	{

}

You can remove that.

 

As for the desired behavior:

obviously they aren't working

Define "not working."  What is it that the code does that you don't want or what is it that the code isn't doing that you do want?

 

Ah thanks didn't notice the unused block, and well what I'm trying to do with the code is make a tool tip for individual items, so for the arrow mould I was "Arrow Mould Text" and for the Banana Seeds I want "Banana Seeds Text" (to test if it works) but it doesn't add a tool tip with any of the three codes, I'm not actually sure why though?

 

 

 

 

I don't really see a difference between the three...?

 

Show where you create MAItems.ArrowMould and BananaSeeds.

 

I created them in this class:

 

MAItems:

 

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;
import com.MonstrousApple.mod.blocks.MABlocks;

import com.MonstrousApple.mod.items.crops.MAItemSeeds;
import com.MonstrousApple.mod.items.durabletools.MAArrowMouldDurableTools;


import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class MAItems {

public static Item ArrowMould;

public static Item BananaSeeds;



public static void initItems() {

	GameRegistry.registerItem(ArrowMould = new MAArrowMouldDurableTools("ArrowMould"), "ArrowMould");

	GameRegistry.registerItem(BananaSeeds = new MAItemSeeds(MABlocks.BananaPlant, Blocks.farmland, "BananaSeeds"), "BananaSeeds");
}
}

Posted

Attempts #1 and #3 look identical to me.

 

By the way, you have an empty block:

	{

}

You can remove that.

 

As for the desired behavior:

obviously they aren't working

Define "not working."  What is it that the code does that you don't want or what is it that the code isn't doing that you do want?

 

Ah thanks didn't notice the unused block, and well what I'm trying to do with the code is make a tool tip for individual items, so for the arrow mould I was "Arrow Mould Text" and for the Banana Seeds I want "Banana Seeds Text" (to test if it works) but it doesn't add a tool tip with any of the three codes, I'm not actually sure why though?

 

 

 

 

I don't really see a difference between the three...?

 

Show where you create MAItems.ArrowMould and BananaSeeds.

 

I created them in this class:

 

MAItems:

 

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;
import com.MonstrousApple.mod.blocks.MABlocks;

import com.MonstrousApple.mod.items.crops.MAItemSeeds;
import com.MonstrousApple.mod.items.durabletools.MAArrowMouldDurableTools;


import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class MAItems {

public static Item ArrowMould;

public static Item BananaSeeds;



public static void initItems() {

	GameRegistry.registerItem(ArrowMould = new MAArrowMouldDurableTools("ArrowMould"), "ArrowMould");

	GameRegistry.registerItem(BananaSeeds = new MAItemSeeds(MABlocks.BananaPlant, Blocks.farmland, "BananaSeeds"), "BananaSeeds");
}
}

Posted

Put the addInfo method in MAItemSeeds and MAArrowMouldDurableTools.

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.

Posted

Put the addInfo method in MAItemSeeds and MAArrowMouldDurableTools.

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.

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.