Jump to content

Item Icon Overlaps Exiting Item


WildBamaBoy

Recommended Posts

Just moved to Forge from ModLoader. While testing I noticed that the icon of one of my items overlaps the Leather Tunic that already exists in Minecraft and a couple of other odd problems with icons.

 

width=800 height=449https://dl.dropbox.com/u/64124307/Minecraft%20Comes%20Alive/Development/jars/screenshots/2012-11-12_01.03.02.png[/img]

 

The first item is my item. The one beside that is the Leather Tunic, and beside that are the two mob eggs that I have added. Note that I do not use Forge's built in method of creating mob eggs, instead I created the egg classes and icons myself. Notice that the eggs have blue arrows on the top left and bottom right. These are not present in the actual icon file.

 

Why is this happening and how do I fix it? I still use ModLoader's methods for adding items if that could be the problem. I am unsure of how to properly do the same using Forge, or if it is any different at all.

 

itemBabyGirl = new ItemBabyGirl(modPropertiesManager.modProperties.itemID_BabyGirl).setIconIndex(ModLoader.addOverride("/gui/items.png", "/MCA/ItemBabyGirl.png")).setItemName("BabyGirl");

Link to comment
Share on other sites

I'd like to see the code for your item, as well as the version of forge you're using this is odd.. this shouldn't happen. We do no alpha blending in the textures, even more, it shouldn't put your texture on a existing slot.

However, beyond that, stop using ModLoader functions -.-

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

What's the proper way of adding items without using ModLoader's functions? I'm using Forge v6.0.1.341.

 

Here's the code for the item.

 

package mca;

import net.minecraft.src.CreativeTabs;

public class ItemBabyGirl extends ItemBaby
{
    public ItemBabyGirl(int i)
    {
        super(i);
        setItemName("Baby Girl");
        gender = "Female";
        setCreativeTab(CreativeTabs.tabMisc);
    }
}

 

And the class it extends from:

package mca;

import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;

public class ItemBaby extends Item
{
public String gender;

public ItemBaby(int i)
{
	super(i);
	maxStackSize = 1;
}

@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int i, int j, int k, int l, float m, float n, float o)
{
	if (MCA.instance.worldPropertiesManager.worldProperties.babyReadyToGrow)
	{
		if (!entityPlayer.worldObj.isRemote)
		{
			entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);

			EntityPlayerChild entityPlayerChild = new EntityPlayerChild(world, entityPlayer, MCA.instance.worldPropertiesManager.worldProperties.babyName, gender);
			entityPlayerChild.setLocationAndAngles(i, j + 1, k, entityPlayer.rotationYaw, entityPlayer.rotationPitch);
			world.spawnEntityInWorld(entityPlayerChild);

			entityPlayer.triggerAchievement(MCA.instance.achievementBabyGrowUp);

			MCA.instance.worldPropertiesManager.worldProperties.babyExists = false;
			MCA.instance.worldPropertiesManager.worldProperties.babyReadyToGrow = false;
			MCA.instance.worldPropertiesManager.worldProperties.minutesBabyExisted = 0;
			MCA.instance.worldPropertiesManager.worldProperties.babyName = "null";
			MCA.instance.worldPropertiesManager.saveWorldProperties();
		}
	}

	return true;
}
}

 

And the code for the eggs:

package mca;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;

import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Facing;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;

public class ItemEggMale extends Item
{
public ItemEggMale(int par1)
{
	super(par1);
	setHasSubtypes(true);
	setCreativeTab(CreativeTabs.tabMisc);
}

public boolean requiresMultipleRenderPasses()
{
	return true;
}

public int getIconFromDamageForRenderPass(int par1, int par2)
{
	if (par2 > 0)
	{
		return super.getIconFromDamageForRenderPass(par1, par2) + 16;
	}
	else
	{
		return super.getIconFromDamageForRenderPass(par1, par2);
	}
}

public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
	if (par3World.isRemote)
	{
		return true;
	}

	int i = par3World.getBlockId(par4, par5, par6);
	par4 += Facing.offsetsXForSide[par7];
	par5 += Facing.offsetsYForSide[par7];
	par6 += Facing.offsetsZForSide[par7];
	double d = 0.0D;

	if (par7 == 1 && i == Block.fence.blockID || i == Block.netherFence.blockID)
	{
		d = 0.5D;
	}

	if (spawnVillager(par3World, par1ItemStack.getItemDamage(), (double)par4 + 0.5D, (double)par5 + d, (double)par6 + 0.5D) && !par2EntityPlayer.capabilities.isCreativeMode)
	{
		par1ItemStack.stackSize--;
	}

	return true;
}

public static boolean spawnVillager(World par0World, int par1, double par2, double par4, double par6)
{
	EntityVillager entityVillager = new EntityVillager(par0World, "Male", new Random().nextInt();

	if (entityVillager != null)
	{
		entityVillager.setLocationAndAngles(par2, par4, par6, par0World.rand.nextFloat() * 360F, 0.0F);

		if (!par0World.isRemote)
		{
			par0World.spawnEntityInWorld(entityVillager);

			for (Map.Entry<Integer, Integer> mapEntry : MCA.instance.idsMap.entrySet())
			{
				if (mapEntry.getValue() > entityVillager.mcaID)
				{
					entityVillager.mcaID = mapEntry.getValue();
				}
			}

			entityVillager.mcaID++;
			MCA.instance.idsMap.put(entityVillager.entityId, entityVillager.mcaID);
			MCA.instance.log(entityVillager.mcaID);
		}
	}

	return entityVillager != null;
}
}

 

package mca;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Facing;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;

public class ItemEggFemale extends Item
{
    public ItemEggFemale(int par1)
    {
        super(par1);
        setHasSubtypes(true);
        setCreativeTab(CreativeTabs.tabMisc);
    }

    public boolean requiresMultipleRenderPasses()
    {
        return true;
    }

    public int getIconFromDamageForRenderPass(int par1, int par2)
    {
        if (par2 > 0)
        {
            return super.getIconFromDamageForRenderPass(par1, par2) + 16;
        }
        else
        {
            return super.getIconFromDamageForRenderPass(par1, par2);
        }
    }

    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
        if (par3World.isRemote)
        {
            return true;
        }

        int i = par3World.getBlockId(par4, par5, par6);
        par4 += Facing.offsetsXForSide[par7];
        par5 += Facing.offsetsYForSide[par7];
        par6 += Facing.offsetsZForSide[par7];
        double d = 0.0D;

        if (par7 == 1 && i == Block.fence.blockID || i == Block.netherFence.blockID)
        {
            d = 0.5D;
        }

        if (spawnVillager(par3World, par1ItemStack.getItemDamage(), (double)par4 + 0.5D, (double)par5 + d, (double)par6 + 0.5D) && !par2EntityPlayer.capabilities.isCreativeMode)
        {
            par1ItemStack.stackSize--;
        }

        return true;
    }

    public static boolean spawnVillager(World par0World, int par1, double par2, double par4, double par6)
    {
    	int profession = new Random().nextInt(;
    	
    	if (profession == 4) profession = 0;
    	
        EntityVillager entityVillager = new EntityVillager(par0World, "Female", profession);
        
        if (entityVillager != null)
        {
        	entityVillager.setLocationAndAngles(par2, par4, par6, par0World.rand.nextFloat() * 360F, 0.0F);
        	
        	if (!par0World.isRemote)
        	{
        		par0World.spawnEntityInWorld(entityVillager);
        		
			for (Map.Entry<Integer, Integer> mapEntry : MCA.instance.idsMap.entrySet())
			{
				if (mapEntry.getValue() > entityVillager.mcaID)
				{
					entityVillager.mcaID = mapEntry.getValue();
				}
			}

			entityVillager.mcaID++;
			MCA.instance.idsMap.put(entityVillager.entityId, entityVillager.mcaID);
			MCA.instance.log(entityVillager.mcaID);
        	}
        }

        return entityVillager != null;
    }
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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