Jump to content

Recommended Posts

Posted

For my mod I'm adding some new ores like copper and tin, ... I'm able to add the ores and smelt them but my problem is when I want to put it into my inventory. When my inventory doesn't contain any ingots and I shift click it out of the furnace the right ingot appears (say for example copper), but if I try to shift-click tin into my inventory while the copper is in it. The tin adds to the stack of copper and transforms itself. When I use a normal click, this doesn't happen and I have the right ingot.

 

My ingot file:

 

 

package dungiaran.machinecraft.common.item;

import java.util.List;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dungiaran.machinecraft.common.creativetabs.MachinecraftTabItems;
import dungiaran.machinecraft.common.lib.Reference;
import dungiaran.machinecraft.common.lib.Strings;

public class ItemIngots extends Item {

Icon[] Textures;

public ItemIngots(int par1) {
	super(par1);

	setUnlocalizedName("ingots");
	setMaxDamage(0);
	setCreativeTab(MachinecraftTabItems.tabMachinecraftItems);
}

@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
	return Strings.INGOT_NAMES[par1ItemStack.getItemDamage()];
}

@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int par1) {
	return Textures[par1];
}

@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
	Textures = new Icon[5];

	for(int i = 0; i < 5; i++)
	{
		Textures[i] = par1IconRegister.registerIcon(Reference.ICONS_INGOTS[i]);		
	}
}

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
	for(int i = 0; i < 5; i++)
	{
		par3List.add(new ItemStack(this, 1, i));
	}
}
}

 

 

I don't know if you need any other files, if so, just ask

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.