Jump to content

Recommended Posts

Posted

I want to add information to my items, I have this code which works when put inside the Item class I have but since all my items are linked to that Item class they all get the same information, how would I make it so that each item has different information?

 

Here's my current code:

 

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

 

 

Item class:

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)
{
list.add("Example");
}
}

 

 

Items class:

package com.MonstrousApple.mod.items;

import java.util.List;

import com.MonstrousApple.mod.MAGlobal;
import com.MonstrousApple.mod.blocks.MABlocks;
import com.MonstrousApple.mod.blocks.crops.MACherryCropDrop;
import com.MonstrousApple.mod.items.armor.MAAssassinArmor;
import com.MonstrousApple.mod.items.armor.MABerserkerArmor;
import com.MonstrousApple.mod.items.armor.MACompactDiamondArmor;
import com.MonstrousApple.mod.items.armor.MACopperArmor;
import com.MonstrousApple.mod.items.armor.MAEmeraldArmor;
import com.MonstrousApple.mod.items.armor.MAKnightArmor;
import com.MonstrousApple.mod.items.armor.MANickelArmor;
import com.MonstrousApple.mod.items.armor.MAObsidianArmor;
import com.MonstrousApple.mod.items.armor.MAPaladinArmor;
import com.MonstrousApple.mod.items.armor.MARubyArmor;
import com.MonstrousApple.mod.items.armor.MASapphireArmor;
import com.MonstrousApple.mod.items.armor.MAScoutArmor;
import com.MonstrousApple.mod.items.armor.MASteelArmor;
import com.MonstrousApple.mod.items.armor.MATestArmor;
import com.MonstrousApple.mod.items.crops.MAItemSeeds;
import com.MonstrousApple.mod.items.durabletools.MAArrowMouldDurableTools;
import com.MonstrousApple.mod.items.durabletools.MABlazeChargeTools;
import com.MonstrousApple.mod.items.durabletools.MABlazeHammerTools;
import com.MonstrousApple.mod.items.durabletools.MANetherStarItems;
import com.MonstrousApple.mod.items.durabletools.MAIngotMouldDurableTools;
import com.MonstrousApple.mod.items.durabletools.MAStainlessSteelDurableTools;
import com.MonstrousApple.mod.items.durabletools.MAStickMouldDurableTools;
import com.MonstrousApple.mod.items.durabletools.MAStringMouldDurableTools;
import com.MonstrousApple.mod.items.foodsetup.MAItemFishFood;
import com.MonstrousApple.mod.items.foodsetup.MAItemFood;
import com.MonstrousApple.mod.items.tools.MAAxe;
import com.MonstrousApple.mod.items.tools.MAGlowingSword;
import com.MonstrousApple.mod.items.tools.MAHoe;
import com.MonstrousApple.mod.items.tools.MANetherBlade;
import com.MonstrousApple.mod.items.tools.MAPickaxe;
import com.MonstrousApple.mod.items.tools.MASpade;
import com.MonstrousApple.mod.items.tools.MASword;

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 {

// Items
public static Item ObsidianStick;
public static Item ObsidianString;
public static Item ObsidianIngot;

public static Item IronPlate;
public static Item GoldPlate;
public static Item DiamondPiece;
public static Item ObsidianPlate;

public static Item SteelIngot;
public static Item StainlessSteelIngot;

public static Item SteelPlate;
public static Item StainlessSteelPlate;

public static Item Chromium;

public static Item SearedLeather;

public static Item SoulHarvesterBlade;
public static Item SoulHarvesterHilt;


// Glowing Items
public static Item BlessedStar;
public static Item CursedStar;


//Bows and Arrows
/**public static Item IronBow;
public static Item IronArrow;

public static Item SteelBow;
public static Item SteelArrow;

public static Item DiamondBow;
public static Item DiamondArrow;

public static Item ObsidianBow;
public static Item Obsidian_pulling_0;
public static Item Obsidian_pulling_1;
public static Item Obsidian_pulling_2;
public static Item ObsidianArrow;

public static Item NetherBow;
public static Item NetherArrow;
*/

// Durable Tools
public static Item StainlessSteelHammer;
public static Item StainlessSteelPeeler;
public static Item StainlessSteelCuttingKnife;
public static Item StainlessSteelChisel;

public static Item StickMould;
public static Item StringMould;
public static Item ArrowMould;
public static Item IngotMould;

public static Item FlameCharge;
public static Item BlazeCharge;
public static Item BlazeHammer;

// Crops
public static Item CherrySeeds;

public static Item BananaSeeds;

// Food
public static Item UncookedPie;
public static Item CookedPie;

public static Item Cherry;
public static Item UncookedCherryPie;
public static Item CookedCherryPie;

public static Item UnpeeledBanana;
public static Item PeeledBanana;
public static Item UncookedBananaPie;
public static Item CookedBananaPie;

public static Item CookedPumpkinPie;

// Fish Food
public static Item RawBass;
public static Item CookedBass;

// Tools (After Enum it's; Harvest Level, Durability/Uses, Efficiency/How Fast It Mines (Float), Damage Dealt (Float), Enchantability;
public static ToolMaterial CopperTools = EnumHelper.addToolMaterial("CopperTools", 2, 250, 6.0F, 2.0F, 14);

public static Item CopperPickaxe;
public static Item CopperAxe;
public static Item CopperSpade;
public static Item CopperHoe;
public static Item CopperSword;


public static ToolMaterial NickelTools = EnumHelper.addToolMaterial("NickelTools", 2, 250, 6.0F, 2.0F, 14);

public static Item NickelPickaxe;
public static Item NickelAxe;
public static Item NickelSpade;
public static Item NickelHoe;
public static Item NickelSword;


public static ToolMaterial SteelTools = EnumHelper.addToolMaterial("SteelTools", 2, 300, 6.0F, 2.0F, 14);

public static Item SteelPickaxe;
public static Item SteelAxe;
public static Item SteelSpade;
public static Item SteelHoe;
public static Item SteelSword;


public static ToolMaterial CompactDiamondTools = EnumHelper.addToolMaterial("CompactDiamondTools", 3, 2341 /** Diamond Tools <780.5< Obsidian Tools */, 12.0F, 4.5F, 15);

public static Item CompactDiamondPickaxe;
public static Item CompactDiamondAxe;
public static Item CompactDiamondSpade;
public static Item CompactDiamondHoe;
public static Item CompactDiamondSword;


public static ToolMaterial ObsidianTools = EnumHelper.addToolMaterial("ObsidianTools", 3, 3122, 16.0F, 6.0F, 10);

public static Item ObsidianPickaxe;
public static Item ObsidianAxe;
public static Item ObsidianSpade;
public static Item ObsidianHoe;
public static Item ObsidianSword;


//Same as Obsidian, just with an invisible blade and slight more enchantability because of the potions
public static ToolMaterial InvisibleTools = EnumHelper.addToolMaterial("InvisibleTools", 3, 3122, 16.0F, 6.0F, 15);

public static Item InvisiBlade;


//Glowing Tools (After Enum it's; Harvest Level, Durability/Uses, Efficiency/How Fast It Mines (Float), Damage Dealt (Float), Enchantability;
public static ToolMaterial NetherTools = EnumHelper.addToolMaterial("NetherTools", 3, 500000, 20.0F, 18.0F, 30);

public static Item NetherSword;


//Same as Compact Diamond, with the ability to make a mob drop it's soul, but with 1000 less durability and double the enchantability
public static ToolMaterial SoulHarvestingTools = EnumHelper.addToolMaterial("SoulHarvestingTools", 3, 1341 /** Diamond Tools <780.5< Obsidian Tools */, 12.0F, 4.5F, 30);

public static Item SoulHarvester;


//Armor (After Enum it's; Max Damage Factor (damage taken before breaking), Armour Values (1 = Half a Armour Bar Point; Helmet, Chestplate, Leggings, Boots), Enchantability;

public static ArmorMaterial CopperArmor = EnumHelper.addArmorMaterial("CopperArmor", MAGlobal.MOD_ID + ":" + "Copper", 15, new int[] { 2, 6, 5, 2, }, 9);

public static Item CopperHelmet;
public static Item CopperChestplate;
public static Item CopperLeggings;
public static Item CopperBoots;

public static ArmorMaterial NickelArmor = EnumHelper.addArmorMaterial("NickelArmor", MAGlobal.MOD_ID + ":" + "Nickel", 15, new int[] { 2, 6, 5, 2, }, 9);

public static Item NickelHelmet;
public static Item NickelChestplate;
public static Item NickelLeggings;
public static Item NickelBoots;

public static ArmorMaterial SteelArmor = EnumHelper.addArmorMaterial("SteelArmor", MAGlobal.MOD_ID + ":" + "Steel", 18, new int[] { 2, 6, 5, 2, }, 9);

public static Item SteelHelmet;
public static Item SteelChestplate;
public static Item SteelLeggings;
public static Item SteelBoots;

public static ArmorMaterial CompactDiamondArmor = EnumHelper.addArmorMaterial("CompactDiamondArmor", MAGlobal.MOD_ID + ":" + "CompactDiamond", 50 /** Diamond Armor <16.5< Obsidian Armor */, new int[] { 3, 8, 6, 3, }, 15);

public static Item CompactDiamondHelmet;
public static Item CompactDiamondChestplate;
public static Item CompactDiamondLeggings;
public static Item CompactDiamondBoots;

public static ArmorMaterial ObsidianArmor = EnumHelper.addArmorMaterial("ObsidianArmor", MAGlobal.MOD_ID + ":" + "Obsidian", 66, new int[] { 3, 8, 6, 3, }, 10);

public static Item ObsidianHelmet;
public static Item ObsidianChestplate;
public static Item ObsidianLeggings;
public static Item ObsidianBoots;

public static ArmorMaterial EmeraldArmor = EnumHelper.addArmorMaterial("EmeraldArmor", MAGlobal.MOD_ID + ":" + "Emerald", 22, new int[] { 3, 8, 6, 3, }, 10);

public static Item EmeraldHelmet;
public static Item EmeraldChestplate;
public static Item EmeraldLeggings;
public static Item EmeraldBoots;

public static ArmorMaterial SapphireArmor = EnumHelper.addArmorMaterial("SapphireArmor", MAGlobal.MOD_ID + ":" + "Sapphire", 22, new int[] { 3, 8, 6, 3, }, 10);

public static Item SapphireHelmet;
public static Item SapphireChestplate;
public static Item SapphireLeggings;
public static Item SapphireBoots;

public static ArmorMaterial RubyArmor = EnumHelper.addArmorMaterial("RubyArmor", MAGlobal.MOD_ID + ":" + "Ruby", 22, new int[] { 3, 8, 6, 3, }, 10);

public static Item RubyHelmet;
public static Item RubyChestplate;
public static Item RubyLeggings;
public static Item RubyBoots;

public static ArmorMaterial KnightArmor = EnumHelper.addArmorMaterial("KnightArmor", MAGlobal.MOD_ID + ":" + "Knight", 50, new int[] { 2, 6, 5, 2, }, 15);

public static Item KnightHelmet;
public static Item KnightChestplate;
public static Item KnightLeggings;
public static Item KnightBoots;

public static ArmorMaterial PaladinArmor = EnumHelper.addArmorMaterial("PaladinArmor", MAGlobal.MOD_ID + ":" + "Paladin", 100, new int[] { 3, 8, 6, 3, }, 30);

public static Item PaladinHelmet;
public static Item PaladinChestplate;
public static Item PaladinLeggings;
public static Item PaladinBoots;

public static ArmorMaterial BerserkerArmor = EnumHelper.addArmorMaterial("BerserkerArmor", MAGlobal.MOD_ID + ":" + "Berserker", 100, new int[] { 3, 8, 6, 3, }, 30);

public static Item BerserkerHelmet;
public static Item BerserkerChestplate;
public static Item BerserkerLeggings;
public static Item BerserkerBoots;

public static ArmorMaterial ScoutArmor = EnumHelper.addArmorMaterial("ScoutArmor", MAGlobal.MOD_ID + ":" + "Scout", 50, new int[] { 2, 6, 5, 2, }, 15);

public static Item ScoutHelmet;
public static Item ScoutChestplate;
public static Item ScoutLeggings;
public static Item ScoutBoots;

public static ArmorMaterial AssassinArmor = EnumHelper.addArmorMaterial("AssassinArmor", MAGlobal.MOD_ID + ":" + "Assassin", 100, new int[] { 3, 8, 6, 3, }, 30);

public static Item AssassinHelmet;
public static Item AssassinChestplate;
public static Item AssassinLeggings;
public static Item AssassinBoots;

public static ArmorMaterial TestArmor = EnumHelper.addArmorMaterial("TestArmor", MAGlobal.MOD_ID + ":" + "Test", 40, new int[] { 1, 1, 1, 1, }, 10);

public static Item TestHelmet;
public static Item TestChestplate;
public static Item TestLeggings;
public static Item TestBoots;

// Ingots
public static Item CopperIngot;
public static Item NickelIngot;

// Gems
public static Item Sapphire;
public static Item Ruby;


public static void initItems() {

	// Items - Register
	GameRegistry.registerItem(ObsidianStick = new MAItem("ObsidianStick"), "ObsidianStick");
	GameRegistry.registerItem(ObsidianString = new MAItem("ObsidianString"), "ObsidianString");
	GameRegistry.registerItem(ObsidianIngot = new MAItem("ObsidianIngot"), "ObsidianIngot");

	GameRegistry.registerItem(IronPlate = new MAItem("IronPlate"), "IronPlate");
	GameRegistry.registerItem(GoldPlate = new MAItem("GoldPlate"), "GoldPlate");
	GameRegistry.registerItem(DiamondPiece = new MAItem("DiamondPiece"), "DiamondPiece");
	GameRegistry.registerItem(ObsidianPlate = new MAItem("ObsidianPlate"), "ObsidianPlate");

	GameRegistry.registerItem(SteelIngot = new MAItem("SteelIngot"), "SteelIngot");
	GameRegistry.registerItem(StainlessSteelIngot = new MAItem("StainlessSteelIngot"), "StainlessSteelIngot");

	GameRegistry.registerItem(SteelPlate = new MAItem("SteelPlate"), "SteelPlate");
	GameRegistry.registerItem(StainlessSteelPlate = new MAItem("StainlessSteelPlate"), "StainlessSteelPlate");

	GameRegistry.registerItem(Chromium = new MAItem("Chromium"), "Chromium");

	GameRegistry.registerItem(SearedLeather = new MAItem("SearedLeather"), "SearedLeather");

	GameRegistry.registerItem(SoulHarvesterBlade = new MAItem("SoulHarvesterBlade"), "SoulHarvesterBlade");
	GameRegistry.registerItem(SoulHarvesterHilt = new MAItem("SoulHarvesterHilt"), "SoulHarvesterHilt");

	// Glowing Items - Register
	GameRegistry.registerItem(BlessedStar = new MANetherStarItems("BlessedStar"), "BlessedStar");
	GameRegistry.registerItem(CursedStar = new MANetherStarItems("CursedStar"), "CursedStar");


	//Bows and Arrows - Register
	//GameRegistry.registerItem(IronBow = new MAIronBow("IronBow"), "IronBow");
	//GameRegistry.registerItem(IronArrow = new MAItem("IronArrow"), "IronArrow");

	//GameRegistry.registerItem(SteelBow = new MASteelBow("SteelBow"), "SteelBow");
	//GameRegistry.registerItem(SteelArrow = new MAItem("SteelArrow"), "SteelArrow");

	//GameRegistry.registerItem(DiamondBow = new MADiamondBow("DiamondBow"), "DiamondBow");
	//GameRegistry.registerItem(DiamondArrow = new MAItem("DiamondArrow"), "DiamondArrow");

	//GameRegistry.registerItem(ObsidianBow = new MAObsidianBow("ObsidianBow"), "ObsidianBow");
	//GameRegistry.registerItem(ObsidianArrow = new MAItem("ObsidianArrow"), "ObsidianArrow");

	//GameRegistry.registerItem(NetherBow = new MANetherBow("NetherBow"), "NetherBow");
	//GameRegistry.registerItem(NetherArrow = new MAItem("NetherArrow"), "NetherArrow");


	// Durable Tools
	GameRegistry.registerItem(StainlessSteelHammer = new MAStainlessSteelDurableTools("StainlessSteelHammer"), "StainlessSteelHammer");
	GameRegistry.registerItem(StainlessSteelPeeler = new MAStainlessSteelDurableTools("StainlessSteelPeeler"), "StainlessSteelPeeler");
	GameRegistry.registerItem(StainlessSteelCuttingKnife = new MAStainlessSteelDurableTools("StainlessSteelCuttingKnife"), "StainlessSteelCuttingKnife");
	GameRegistry.registerItem(StainlessSteelChisel = new MAStainlessSteelDurableTools("StainlessSteelChisel"), "StainlessSteelChisel");

	GameRegistry.registerItem(StickMould = new MAStickMouldDurableTools("StickMould"), "StickMould");
	GameRegistry.registerItem(StringMould = new MAStringMouldDurableTools("StringMould"), "StringMould");
	GameRegistry.registerItem(ArrowMould = new MAArrowMouldDurableTools("ArrowMould"), "ArrowMould");
	GameRegistry.registerItem(IngotMould = new MAIngotMouldDurableTools("IngotMould"), "IngotMould");

	GameRegistry.registerItem(FlameCharge = new MABlazeChargeTools("FlameCharge"), "FlameCharge");
	GameRegistry.registerItem(BlazeCharge = new MABlazeChargeTools("BlazeCharge"), "BlazeCharge");
	GameRegistry.registerItem(BlazeHammer = new MABlazeHammerTools("BlazeHammer"), "BlazeHammer");

	// Crops
	GameRegistry.registerItem(CherrySeeds = new MAItemSeeds(MABlocks.CherryPlant, Blocks.farmland, "CherrySeeds"), "CherrySeeds");

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

	// Food - Register; Name - Amount of Food Given - Amount of Saturation
	// Given - True or False for if it can be fed to wolves)
	// Cooked beef gives; 8 - 0.8F - True/False
	// For potions add on the end, .setPotionEffect(Potion.example.id,
	// duration, amplifier, probability [0.5 being half, 50%]),

	GameRegistry.registerItem(UncookedPie = new MAItemFood("UncookedPie", 4, 0.4F, false), "UncookedPie");
	GameRegistry.registerItem(CookedPie = new MAItemFood("CookedPie", 7, 0.7F, false), "CookedPie");

	GameRegistry.registerItem(Cherry = new MAItemFood("Cherry", 3, 0.3F, false), "Cherry");
	GameRegistry.registerItem(UncookedCherryPie = new MAItemFood("UncookedCherryPie", 5, 0.5F, false), "UncookedCherryPie");
	GameRegistry.registerItem(CookedCherryPie = new MAItemFood("CookedCherryPie", 9, 0.9F, false), "CookedCherryPie");

	GameRegistry.registerItem(UnpeeledBanana = new MAItemFood("UnpeeledBanana", 1, 0.1F, false), "UnpeeledBanana");
	GameRegistry.registerItem(PeeledBanana = new MAItemFood("PeeledBanana", 3, 0.3F, false), "PeeledBanana");
	GameRegistry.registerItem(UncookedBananaPie = new MAItemFood("UncookedBananaPie", 5, 0.5F, false), "UncookedBananaPie");
	GameRegistry.registerItem(CookedBananaPie = new MAItemFood("CookedBananaPie", 9, 0.9F, false), "CookedBananaPie");

	GameRegistry.registerItem(CookedPumpkinPie = new MAItemFood("CookedPumpkinPie", 9, 0.9F, false), "CookedPumpkinPie");

	// Fish Food - Register
	// Cooked cod gives; ? - ?.?F - True/False
	// For potions add on the end, .setPotionEffect(Potion.example.id,
	// duration, amplifier, probability [0.5 being half, 50%]),
	GameRegistry.registerItem(RawBass = new MAItemFood("RawBass", 2, 0.2F, false).setPotionEffect(Potion.hunger.id, 10, 1 - 1, 1F).setPotionEffect(Potion.absorption.id, 10, 1 - 1, 1F), "RawBass");
	GameRegistry.registerItem(CookedBass = new MAItemFood("CookedBass", 4, 0.8F, false), "CookedBass");

	// Tools - Register
	GameRegistry.registerItem(CopperPickaxe = new MAPickaxe("CopperPickaxe", CopperTools), "CopperPickaxe");
	GameRegistry.registerItem(CopperAxe = new MAAxe("CopperAxe", CopperTools), "CopperAxe");
	GameRegistry.registerItem(CopperSpade = new MASpade("CopperSpade", CopperTools), "CopperSpade");
	GameRegistry.registerItem(CopperHoe = new MAHoe("CopperHoe", CopperTools), "CopperHoe");
	GameRegistry.registerItem(CopperSword = new MASword("CopperSword", CopperTools), "CopperSword");

	GameRegistry.registerItem(NickelPickaxe = new MAPickaxe("NickelPickaxe", NickelTools), "NickelPickaxe");
	GameRegistry.registerItem(NickelAxe = new MAAxe("NickelAxe", NickelTools), "NickelAxe");
	GameRegistry.registerItem(NickelSpade = new MASpade("NickelSpade", NickelTools), "NickelSpade");
	GameRegistry.registerItem(NickelHoe = new MAHoe("NickelHoe", NickelTools), "NickelHoe");
	GameRegistry.registerItem(NickelSword = new MASword("NickelSword", NickelTools), "NickelSword");

	GameRegistry.registerItem(SteelPickaxe = new MAPickaxe("SteelPickaxe", SteelTools), "SteelPickaxe");
	GameRegistry.registerItem(SteelAxe = new MAAxe("SteelAxe", SteelTools), "SteelAxe");
	GameRegistry.registerItem(SteelSpade = new MASpade("SteelSpade", SteelTools), "SteelSpade");
	GameRegistry.registerItem(SteelHoe = new MAHoe("SteelHoe", SteelTools), "SteelHoe");
	GameRegistry.registerItem(SteelSword = new MASword("SteelSword", SteelTools), "SteelSword");

	GameRegistry.registerItem(CompactDiamondPickaxe = new MAPickaxe("CompactDiamondPickaxe", CompactDiamondTools), "CompactDiamondPickaxe");
	GameRegistry.registerItem(CompactDiamondAxe = new MAAxe("CompactDiamondAxe", CompactDiamondTools), "CompactDiamondAxe");
	GameRegistry.registerItem(CompactDiamondSpade = new MASpade("CompactDiamondSpade", CompactDiamondTools), "CompactDiamondSpade");
	GameRegistry.registerItem(CompactDiamondHoe = new MAHoe("CompactDiamondHoe", CompactDiamondTools), "CompactDiamondHoe");
	GameRegistry.registerItem(CompactDiamondSword = new MASword("CompactDiamondSword", CompactDiamondTools), "CompactDiamondSword");

	GameRegistry.registerItem(ObsidianPickaxe = new MAPickaxe("ObsidianPickaxe", ObsidianTools), "ObsidianPickaxe");
	GameRegistry.registerItem(ObsidianAxe = new MAAxe("ObsidianAxe", ObsidianTools), "ObsidianAxe");
	GameRegistry.registerItem(ObsidianSpade = new MASpade("ObsidianSpade", ObsidianTools), "ObsidianSpade");
	GameRegistry.registerItem(ObsidianHoe = new MAHoe("ObsidianHoe", ObsidianTools), "ObsidianHoe");
	GameRegistry.registerItem(ObsidianSword = new MASword("ObsidianSword", ObsidianTools), "ObsidianSword");

	//Same as Obsidian, just with an invisible blade and slight more enchantability because of the potions
	GameRegistry.registerItem(InvisiBlade = new MASword("InvisiBlade", InvisibleTools), "InvisiBlade");

	// Glowing Tools - Register
	GameRegistry.registerItem(NetherSword = new MANetherBlade("NetherSword", NetherTools), "NetherSword");

	GameRegistry.registerItem(SoulHarvester = new MASword("SoulHarvester", SoulHarvestingTools), "SoulHarvester");


	// Armor - Register
	GameRegistry.registerItem(CopperHelmet = new MACopperArmor("CopperHelmet", CopperArmor, 1, 0), "CopperHelmet");
	GameRegistry.registerItem(CopperChestplate = new MACopperArmor("CopperChestplate", CopperArmor, 1, 1), "CopperChestplate");
	GameRegistry.registerItem(CopperLeggings = new MACopperArmor("CopperLeggings", CopperArmor, 2, 2), "CopperLeggings");
	GameRegistry.registerItem(CopperBoots = new MACopperArmor("CopperBoots", CopperArmor, 1, 3), "CopperBoots");

	GameRegistry.registerItem(NickelHelmet = new MANickelArmor("NickelHelmet", NickelArmor, 1, 0), "NickelHelmet");
	GameRegistry.registerItem(NickelChestplate = new MANickelArmor("NickelChestplate", NickelArmor, 1, 1), "NickelChestplate");
	GameRegistry.registerItem(NickelLeggings = new MANickelArmor("NickelLeggings", NickelArmor, 2, 2), "NickelLeggings");
	GameRegistry.registerItem(NickelBoots = new MANickelArmor("NickelBoots", NickelArmor, 1, 3), "NickelBoots");

	GameRegistry.registerItem(SteelHelmet = new MASteelArmor("SteelHelmet", SteelArmor, 1, 0), "SteelHelmet");
	GameRegistry.registerItem(SteelChestplate = new MASteelArmor("SteelChestplate", SteelArmor, 1, 1), "SteelChestplate");
	GameRegistry.registerItem(SteelLeggings = new MASteelArmor("SteelLeggings", SteelArmor, 2, 2), "SteelLeggings");
	GameRegistry.registerItem(SteelBoots = new MASteelArmor("SteelBoots", SteelArmor, 1, 3), "SteelBoots");

	GameRegistry.registerItem(CompactDiamondHelmet = new MACompactDiamondArmor("CompactDiamondHelmet", CompactDiamondArmor, 1, 0), "CompactDiamondHelmet");
	GameRegistry.registerItem(CompactDiamondChestplate = new MACompactDiamondArmor("CompactDiamondChestplate", CompactDiamondArmor, 1, 1), "CompactDiamondChestplate");
	GameRegistry.registerItem(CompactDiamondLeggings = new MACompactDiamondArmor("CompactDiamondLeggings", CompactDiamondArmor, 2, 2), "CompactDiamondLeggings");
	GameRegistry.registerItem(CompactDiamondBoots = new MACompactDiamondArmor("CompactDiamondBoots", CompactDiamondArmor, 1, 3), "CompactDiamondBoots");

	GameRegistry.registerItem(ObsidianHelmet = new MAObsidianArmor("ObsidianHelmet", ObsidianArmor, 1, 0), "ObsidianHelmet");
	GameRegistry.registerItem(ObsidianChestplate = new MAObsidianArmor("ObsidianChestplate", ObsidianArmor, 1, 1), "ObsidianChestplate");
	GameRegistry.registerItem(ObsidianLeggings = new MAObsidianArmor("ObsidianLeggings", ObsidianArmor, 2, 2), "ObsidianLeggings");
	GameRegistry.registerItem(ObsidianBoots = new MAObsidianArmor("ObsidianBoots", ObsidianArmor, 1, 3), "ObsidianBoots");

	GameRegistry.registerItem(EmeraldHelmet = new MAEmeraldArmor("EmeraldHelmet", EmeraldArmor, 1, 0), "EmeraldHelmet");
	GameRegistry.registerItem(EmeraldChestplate = new MAEmeraldArmor("EmeraldChestplate", EmeraldArmor, 1, 1), "EmeraldChestplate");
	GameRegistry.registerItem(EmeraldLeggings = new MAEmeraldArmor("EmeraldLeggings", EmeraldArmor, 2, 2), "EmeraldLeggings");
	GameRegistry.registerItem(EmeraldBoots = new MAEmeraldArmor("EmeraldBoots", EmeraldArmor, 1, 3), "EmeraldBoots");

	GameRegistry.registerItem(SapphireHelmet = new MASapphireArmor("SapphireHelmet", SapphireArmor, 1, 0), "SapphireHelmet");
	GameRegistry.registerItem(SapphireChestplate = new MASapphireArmor("SapphireChestplate", SapphireArmor, 1, 1), "SapphireChestplate");
	GameRegistry.registerItem(SapphireLeggings = new MASapphireArmor("SapphireLeggings", SapphireArmor, 2, 2), "SapphireLeggings");
	GameRegistry.registerItem(SapphireBoots = new MASapphireArmor("SapphireBoots", SapphireArmor, 1, 3), "SapphireBoots");

	GameRegistry.registerItem(RubyHelmet = new MARubyArmor("RubyHelmet", RubyArmor, 1, 0), "RubyHelmet");
	GameRegistry.registerItem(RubyChestplate = new MARubyArmor("RubyChestplate", RubyArmor, 1, 1), "RubyChestplate");
	GameRegistry.registerItem(RubyLeggings = new MARubyArmor("RubyLeggings", RubyArmor, 2, 2), "RubyLeggings");
	GameRegistry.registerItem(RubyBoots = new MARubyArmor("RubyBoots", RubyArmor, 1, 3), "RubyBoots");

	GameRegistry.registerItem(KnightHelmet = new MAKnightArmor("KnightHelmet", KnightArmor, 1, 0), "KnightHelmet");
	GameRegistry.registerItem(KnightChestplate = new MAKnightArmor("KnightChestplate", KnightArmor, 1, 1), "KnightChestplate");
	GameRegistry.registerItem(KnightLeggings = new MAKnightArmor("KnightLeggings", KnightArmor, 2, 2), "KnightLeggings");
	GameRegistry.registerItem(KnightBoots = new MAKnightArmor("KnightBoots", KnightArmor, 1, 3), "KnightBoots");

	GameRegistry.registerItem(PaladinHelmet = new MAPaladinArmor("PaladinHelmet", PaladinArmor, 1, 0), "PaladinHelmet");
	GameRegistry.registerItem(PaladinChestplate = new MAPaladinArmor("PaladinChestplate", PaladinArmor, 1, 1), "PaladinChestplate");
	GameRegistry.registerItem(PaladinLeggings = new MAPaladinArmor("PaladinLeggings", PaladinArmor, 2, 2), "PaladinLeggings");
	GameRegistry.registerItem(PaladinBoots = new MAPaladinArmor("PaladinBoots", PaladinArmor, 1, 3), "PaladinBoots");

	GameRegistry.registerItem(BerserkerHelmet = new MABerserkerArmor("BerserkerHelmet", BerserkerArmor, 1, 0), "BerserkerHelmet");
	GameRegistry.registerItem(BerserkerChestplate = new MABerserkerArmor("BerserkerChestplate", BerserkerArmor, 1, 1), "BerserkerChestplate");
	GameRegistry.registerItem(BerserkerLeggings = new MABerserkerArmor("BerserkerLeggings", BerserkerArmor, 2, 2), "BerserkerLeggings");
	GameRegistry.registerItem(BerserkerBoots = new MABerserkerArmor("BerserkerBoots", BerserkerArmor, 1, 3), "BerserkerBoots");

	GameRegistry.registerItem(ScoutHelmet = new MAScoutArmor("ScoutHelmet", ScoutArmor, 1, 0), "ScoutHelmet");
	GameRegistry.registerItem(ScoutChestplate = new MAScoutArmor("ScoutChestplate", ScoutArmor, 1, 1), "ScoutChestplate");
	GameRegistry.registerItem(ScoutLeggings = new MAScoutArmor("ScoutLeggings", ScoutArmor, 2, 2), "ScoutLeggings");
	GameRegistry.registerItem(ScoutBoots = new MAScoutArmor("ScoutBoots", ScoutArmor, 1, 3), "ScoutBoots");

	GameRegistry.registerItem(AssassinHelmet = new MAAssassinArmor("AssassinHelmet", AssassinArmor, 1, 0), "AssassinHelmet");
	GameRegistry.registerItem(AssassinChestplate = new MAAssassinArmor("AssassinChestplate", AssassinArmor, 1, 1), "AssassinChestplate");
	GameRegistry.registerItem(AssassinLeggings = new MAAssassinArmor("AssassinLeggings", AssassinArmor, 2, 2), "AssassinLeggings");
	GameRegistry.registerItem(AssassinBoots = new MAAssassinArmor("AssassinBoots", AssassinArmor, 1, 3), "AssassinBoots");

	GameRegistry.registerItem(TestHelmet = new MATestArmor("TestHelmet", TestArmor, 1, 0), "TestHelmet");
	GameRegistry.registerItem(TestChestplate = new MATestArmor("TestChestplate", TestArmor, 1, 1), "TestChestplate");
	GameRegistry.registerItem(TestLeggings = new MATestArmor("TestLeggings", TestArmor, 2, 2), "TestLeggings");
	GameRegistry.registerItem(TestBoots = new MATestArmor("TestBoots", TestArmor, 1, 3), "TestBoots");

	// Ingots - Register
	GameRegistry.registerItem(CopperIngot = new MAItem("CopperIngot"), "CopperIngot");
	GameRegistry.registerItem(NickelIngot = new MAItem("NickelIngot"), "NickelIngot");

	// Gems - Register
	GameRegistry.registerItem(Sapphire = new MAItem("Sapphire"), "Sapphire");
	GameRegistry.registerItem(Ruby = new MAItem("Ruby"), "Ruby");

}
}

 

Posted

Either create a separate class for each item with a tooltip (if you only have a few different ones) or create a class that accepts a tooltip (either a single string or a collection of strings) as a constructor argument, stores it in a field and uses it in its override of

Item#addInformation

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Yeah I was thinking about doing the first option but I have over 150 items to make tool tips for so that would take ages xD but yeah the second option seems more viable, but yeah would it be okay for an example code please?

Posted

You can't just ask for example code every time you get an answer. Try to figure out the implementation yourself.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Or use the passed ItemStack to differentiate.

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

So like 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, ItemStack stack, EntityPlayer playerIn, List list, boolean par4) {
	super();

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

}

 

GameRegistry.registerItem(SoulHarvesterBlade = new MAItem("SoulHarvesterBlade", null, null, null, false), "SoulHarvesterBlade");

 

Just change the third null to what if that's correct?

Posted

No, not like this.

 

Dude, modding is just another name for coding - and you my friend apparently know nothing about it.

What you just did proves that you don't understand object oriented programming, what is a constructor, method or overriding it.

 

You have no clue what you are doing and copying from examples won't help much.

 

1. Read "Modder Support" sub-forum description.

2. Google java tutorials on objects, constructors and inheritance - oracle has them plenty and nice.

3. Learn.

4. Come back and fix your mistakes.

 

Additionally: There is plenty open sources - you can look up any of them.

OR - look at vanilla code!

 

EDIT

 

As to what you want:

1. Like you pass "name", also pass (to constructor) list of information to display.

2. Save list in Item instance.

3. In addInformation do list.addAll(listSavedInItem).

1.7.10 is no longer supported by forge, you are on your own.

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.