Jump to content

Recommended Posts

Posted

First of very nice forums.

Before I have made the Peacefulpack compatible with forge and used the 256x256 texture files to only use 2 files, so I know how to do that.

Right now I'm working on getting another mod forge compatible. I have already placed all the pictures into 2 256x256 files, but there is 1 difference between the mod I'm changing now and the peacefulpack. In this mod I have throwable entities that are textured with RenderSnowball.

Right now I have this code for 1 of the items (there are 4 in total that have this):

 

mod_Magicalexperience

 

@MLProp public static int ClusterBottleID = 520;

public static Item clusterbottle;

public void load()

  {

  clusterbottle = new ItemClusterBottle(ClusterBottleID).setIconIndex(11).setItemName("clusterbottle");

  ModLoader.addName(clusterbottle, "Cluster Bottle");

  MinecraftForgeClient.preloadTexture("/MagicalExp/Items.png");

  }

public void addRenderer(Map map)

    {

      map.put(EntityClusterBottle.class, new RenderSnowball(mod_Magicalexperience.clusterbottle.iconIndex));     

    }

 

ItemClusterBottle

 

package net.minecraft.src;

 

import net.minecraft.src.forge.*;

 

public class ItemClusterBottle extends Item implements ITextureProvider

{

public ItemClusterBottle(int i)

    {

        super(i);

        maxStackSize = 64;

    }

 

public String getTextureFile()

    {

            return "/MagicalExp/Items.png";

    }

 

public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)

    {

        if (!par3EntityPlayer.capabilities.isCreativeMode)

        {

            par1ItemStack.stackSize--;

        }

 

        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

 

        if (!par2World.isRemote)

        {

            par2World.spawnEntityInWorld(new EntityClusterBottle(par2World, par3EntityPlayer));

        }

 

        return par1ItemStack;

    }

}

 

And EntityClusterbottle

 

 

package net.minecraft.src;

 

import java.util.Random;

 

public class EntityClusterBottle extends EntityThrowable

{

    public EntityClusterBottle(World par1World)

    {

        super(par1World);

    }

 

    public EntityClusterBottle(World par1World, EntityLiving par2EntityLiving)

    {

        super(par1World, par2EntityLiving);

    }

 

    public EntityClusterBottle(World par1World, double par2, double par4, double par6)

    {

        super(par1World, par2, par4, par6);

    }

 

    protected float func_40075_e()

    {

        return 0.07F;

    }

 

    protected float func_40077_c()

    {

        return 0.7F;

    }

 

    protected float func_40074_d()

    {

        return -20F;

    }

 

    /**

    * Called when the throwable hits a block or entity.

    */

    protected void onImpact(MovingObjectPosition par1MovingObjectPosition)

    {

        if (!worldObj.isRemote)

        {

            worldObj.playAuxSFX(2002, (int)Math.round(posX), (int)Math.round(posY), (int)Math.round(posZ), 0);

 

            for (int i = 3 + worldObj.rand.nextInt(5) + worldObj.rand.nextInt(5); i > 0;)

            {

                int j = EntityXPOrb.getXPSplit(i);

                i -= j;

                worldObj.createExplosion(null, posX, posY, posZ, rand.nextInt(4));

                worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX + rand.nextInt(5), posY, posZ + rand.nextInt(5)));

                worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX - rand.nextInt(5), posY, posZ + rand.nextInt(5)));

                worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX + rand.nextInt(5), posY, posZ - rand.nextInt(5)));

                worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX - rand.nextInt(5), posY, posZ - rand.nextInt(5)));

            }

 

            setDead();

        }

    }

}

 

In the inventory all the items look the way they should, but when I throw one of those entities it will show the texture from the vanillan items.png making this bottle a golden apple in the air.

How do I get it to load the texture from my items.png?

 

Found out how to fix it.

Just copy RenderSnowball, make a new Renderfile and change:

this.loadTexture("/gui/items.png");

into

this.loadTexture("/MagicalExp/Items.png");

 

Derp :-X

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.