Jump to content

Bullet = Leather Helmet


StealerSlain

Recommended Posts

Hello again. I have this problem:

width=800 height=449https://dl.dropbox.com/u/100634244/2012-12-21_16.09.21.png[/img]

 

My Codes:

 

RENDER AS SNOWBALL

 

NO MODEL

 

ENTITY

 

package ***;

 

import net.minecraft.src.*;

 

public class EntityMagicBullet extends EntityThrowable

{

        public EntityMagicBullet(World world)

        {

                super(world);

        }      public EntityMagicBullet(World world, EntityLiving entityliving)

        {

                super(world, entityliving);

        }

        public EntityMagicBullet(World world, double d, double d1, double d2)

        {

                super(world, d, d1, d2);

        }      protected void onImpact(MovingObjectPosition movingobjectposition)

        {

                if (movingobjectposition.entityHit != null)

                {

                        if (!movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, thrower), 4));

                }

                for (int i = 0; i < 1; i++)

                {

                        worldObj.spawnParticle("portal", posX, posY, posZ, 0.0D, 0.0D, 0.0D);

                }

                {

                        setDead();

                }

        }

}

 

 

BASE MOD FILE

A lot of information, but I cut out only the main

	public void addRenderer(Map map)
  {
   map.put(net.smcrafting.src.EntityMagicBullet.class, new RenderSnowball(this.MagicBullet.getIconFromDamage(0)));
  }

	private void registerEntity2(Class <? extends Entity> entityClass, Render renderer, String entityName, String description, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) {
	  RenderingRegistry.registerEntityRenderingHandler(entityClass, renderer);
	  EntityRegistry.registerModEntity(EntityMummy.class, "Magic Bullet", 8002, this, 250, 5, false);
	  LanguageRegistry.instance().addStringLocalization("entity.Bullet" + entityName + ".name", description);
	 }

@Init
public void load(FMLInitializationEvent event){
registerEntity2(EntityMagicBullet.class, new RenderSnowball(0), "Magic Bullet", "Magic Bullet", 1, 64, 10, true);

 

CLIENT PROXY

  RenderingRegistry.registerEntityRenderingHandler(EntityMagicBullet.class, new RenderSnowball(BaseMod.MagicBullet.getIconFromDamage(0)));

 

Thank you for help

Link to comment
Share on other sites

Well, this one is easy to fix:

 

map.put(net.smcrafting.src.EntityMagicBullet.class, new RenderSnowball(this.MagicBullet.getIconFromDamage(0)));

 

You said it to get icon index 0. If you go into RenderSnowBall, you can see that in doRender it uses: this.loadTexture("/gui/items.png");

And  icon index 0 in items.png is, you guessed it, a leather helmet.

 

So there's no other way then to create a custom render class (like RenderMagicBullet) and do this.loadTexture("your path here"); in the doRender method. (You can copy the RenderSnowBall class for this I guess...)

 

When you're done, don't forget to change

map.put(net.smcrafting.src.EntityMagicBullet.class, new RenderSnowball(this.MagicBullet.getIconFromDamage(0)));

to:

map.put(net.smcrafting.src.EntityMagicBullet.class, new RenderMagicBullet(this.MagicBullet.getIconFromDamage(0)));

Link to comment
Share on other sites

Nothing has changed.

this.loadTexture("/SMCrafting/stealerslain/smcrafting/client/items.png");

+

public void addRenderer(Map map)
  {
   map.put(net.smcrafting.src.EntityMagicBullet.class, new RenderMagicBullet(this.MagicBullet.getIconFromDamage(0)));
  }

=

White Leather Helmet.

And yes, I create RenderMagicBullet class.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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