Jump to content

Not using my Entity


Dealman

Recommended Posts

Okay, I've just recently started using Forge and am currently trying to add my own custom arrow without the modification of any base files, as I understand it - this should be possible with the use of IArrowNockHandler and IArrowLooseHandler, I understand that the NockHandler is when you use the bow(Nock the arrow, duh) and Loose when you fire, or have I got this all wrong?

 

Either way, I've played around with it for a while with a friend of mine who's really good at programming(Although in other languages), but we really can't get any further. The problem is that when we use the Bow and fire my custom arrow with it(Haven't added the Nock yet.) it still shoots the white arrow.

 

I've made my own 32x32 Pixel PNG Texture for it to use.

 

In my mod_ file I've got this;

 

 

public static final Item itemOlivineArrow = new ItemOlivineArrow(itemOlivineArrowShiftedIndex).setIconIndex(5).setItemName("OlivineArrow");

public void addRenderer(Map map)
{
  map.put(EntityOlivineArrow.class, new RenderOlivineArrow());
}

 

 

EntityOlivineArrow;

 

 

package net.minecraft.src;

import java.util.List;
import java.util.Random;

public class EntityOlivineArrow extends EntityArrow
{
    private int xTile;
    private int yTile;
    private int zTile;
    private int inTile;
    private int inData;
    private boolean inGround;
    public boolean doesArrowBelongToPlayer;

    /** Seems to be some sort of timer for animating an arrow. */
    public int arrowShake;

    /** The owner of this arrow. */
    public Entity shootingEntity;
    private int ticksInGround;
    private int ticksInAir;
    private double damage;
    private int field_46027_au;

    /** Is this arrow a critical hit? (Controls particles and damage) */
    public boolean arrowCritical;

    public EntityOlivineArrow(World par1World)
    {
        super(par1World);
        xTile = -1;
        yTile = -1;
        zTile = -1;
        inTile = 0;
        inData = 0;
        inGround = false;
        doesArrowBelongToPlayer = false;
        arrowShake = 0;
        ticksInAir = 0;
        damage = 20D;//2
        arrowCritical = false;
        setSize(1.5F, 0.5F);//0.5
    }

    public EntityOlivineArrow(World par1World, double par2, double par4, double par6)
    {
        super(par1World);
        xTile = -1;
        yTile = -1;
        zTile = -1;
        inTile = 0;
        inData = 0;
        inGround = false;
        doesArrowBelongToPlayer = false;
        arrowShake = 0;
        ticksInAir = 0;
        damage = 20D;
        arrowCritical = false;
        setSize(1.5F, 0.5F);
        setPosition(par2, par4, par6);
        yOffset = 0.0F;
    }

    public EntityOlivineArrow(World par1World, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, float par4, float par5)
    {
        super(par1World);
        xTile = -1;
        yTile = -1;
        zTile = -1;
        inTile = 0;
        inData = 0;
        inGround = false;
        doesArrowBelongToPlayer = false;
        arrowShake = 0;
        ticksInAir = 0;
        damage = 2D;
        arrowCritical = false;
        shootingEntity = par2EntityLiving;
        doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
        posY = (par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight()) - 0.10000000149011612D;
        double d = par3EntityLiving.posX - par2EntityLiving.posX;
        double d1 = (par3EntityLiving.posY + (double)par3EntityLiving.getEyeHeight()) - 0.69999998807907104D - posY;
        double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ;
        double d3 = MathHelper.sqrt_double(d * d + d2 * d2);

        if (d3 < 9.9999999999999995E-008D)
        {
            return;
        }
        else
        {
            float f = (float)((Math.atan2(d2, d) * 180D) / Math.PI) - 90F;
            float f1 = (float)(-((Math.atan2(d1, d3) * 180D) / Math.PI));
            double d4 = d / d3;
            double d5 = d2 / d3;
            setLocationAndAngles(par2EntityLiving.posX + d4, posY, par2EntityLiving.posZ + d5, f, f1);
            yOffset = 0.0F;
            float f2 = (float)d3 * 0.2F;
            setArrowHeading(d, d1 + (double)f2, d2, par4, par5);
            return;
        }
    }

    public EntityOlivineArrow(World par1World, EntityLiving par2EntityLiving, float par3)
    {
        super(par1World);
        xTile = -1;
        yTile = -1;
        zTile = -1;
        inTile = 0;
        inData = 0;
        inGround = false;
        doesArrowBelongToPlayer = false;
        arrowShake = 0;
        ticksInAir = 0;
        damage = 2D;
        arrowCritical = false;
        shootingEntity = par2EntityLiving;
        doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
        setSize(0.5F, 0.5F);
        setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
        posX -= MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
        posY -= 0.10000000149011612D;
        posZ -= MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
        setPosition(posX, posY, posZ);
        yOffset = 0.0F;
        motionX = -MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
        motionZ = MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
        motionY = -MathHelper.sin((rotationPitch / 180F) * (float)Math.PI);
        setArrowHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
    }

    protected void entityInit()
    {
    }

    /**
     * Uses the provided coordinates as a heading and determines the velocity from it with the set force and random
     * variance. Args: x, y, z, force, forceVariation
     */
    public void setArrowHeading(double par1, double par3, double par5, float par7, float par8)
    {
        float f = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
        par1 /= f;
        par3 /= f;
        par5 /= f;
        par1 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
        par3 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
        par5 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
        par1 *= par7;
        par3 *= par7;
        par5 *= par7;
        motionX = par1;
        motionY = par3;
        motionZ = par5;
        float f1 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
        prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
        prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f1) * 180D) / Math.PI);
        ticksInGround = 0;
    }

    /**
     * Sets the velocity to the args. Args: x, y, z
     */
    public void setVelocity(double par1, double par3, double par5)
    {
        motionX = par1;
        motionY = par3;
        motionZ = par5;

        if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
        {
            float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
            prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
            prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f) * 180D) / Math.PI);
            prevRotationPitch = rotationPitch;
            prevRotationYaw = rotationYaw;
            setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
            ticksInGround = 0;
        }
    }

    /**
     * Called to update the entity's position/logic.
     */
    public void onUpdate()
    {
        super.onUpdate();

        if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
        {
            float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
            prevRotationYaw = rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
            prevRotationPitch = rotationPitch = (float)((Math.atan2(motionY, f) * 180D) / Math.PI);
        }

        int i = worldObj.getBlockId(xTile, yTile, zTile);

        if (i > 0)
        {
            Block.blocksList[i].setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
            AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);

            if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3D.createVector(posX, posY, posZ)))
            {
                inGround = true;
            }
        }

        if (arrowShake > 0)
        {
            arrowShake--;
        }

        if (inGround)
        {
            int j = worldObj.getBlockId(xTile, yTile, zTile);
            int k = worldObj.getBlockMetadata(xTile, yTile, zTile);

            if (j != inTile || k != inData)
            {
                inGround = false;
                motionX *= rand.nextFloat() * 0.2F;
                motionY *= rand.nextFloat() * 0.2F;
                motionZ *= rand.nextFloat() * 0.2F;
                ticksInGround = 0;
                ticksInAir = 0;
                return;
            }

            ticksInGround++;

            if (ticksInGround == 1200)
            {
                setDead();
            }

            return;
        }

        ticksInAir++;
        Vec3D vec3d = Vec3D.createVector(posX, posY, posZ);
        Vec3D vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
        MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks_do_do(vec3d, vec3d1, false, true);
        vec3d = Vec3D.createVector(posX, posY, posZ);
        vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);

        if (movingobjectposition != null)
        {
            vec3d1 = Vec3D.createVector(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
        }

        Entity entity = null;
        List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
        double d = 0.0D;

        for (int l = 0; l < list.size(); l++)
        {
            Entity entity1 = (Entity)list.get(l);

            if (!entity1.canBeCollidedWith() || entity1 == shootingEntity && ticksInAir < 5)
            {
                continue;
            }

            float f5 = 0.3F;
            AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f5, f5, f5);
            MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);

            if (movingobjectposition1 == null)
            {
                continue;
            }

            double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);

            if (d1 < d || d == 0.0D)
            {
                entity = entity1;
                d = d1;
            }
        }

        if (entity != null)
        {
            movingobjectposition = new MovingObjectPosition(entity);
        }

        if (movingobjectposition != null)
        {
            if (movingobjectposition.entityHit != null)
            {
                float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
                int j1 = (int)Math.ceil((double)f1 * damage);

                if (arrowCritical)
                {
                    j1 += rand.nextInt(j1 / 2 + 2);
                }

                DamageSource damagesource = null;

                if (shootingEntity == null)
                {
                    damagesource = DamageSource.causeArrowDamage(this, this);
                }
                else
                {
                    damagesource = DamageSource.causeArrowDamage(this, shootingEntity);
                }

                if (isBurning())
                {
                    movingobjectposition.entityHit.setFire(5);
                }

                if (movingobjectposition.entityHit.attackEntityFrom(damagesource, j1))
                {
                    if (movingobjectposition.entityHit instanceof EntityLiving)
                    {
                        ((EntityLiving)movingobjectposition.entityHit).arrowHitTempCounter++;

                        if (field_46027_au > 0)
                        {
                            float f7 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);

                            if (f7 > 0.0F)
                            {
                                movingobjectposition.entityHit.addVelocity((motionX * (double)field_46027_au * 0.60000002384185791D) / (double)f7, 0.10000000000000001D, (motionZ * (double)field_46027_au * 0.60000002384185791D) / (double)f7);
                            }
                        }
                    }

                    worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
                    setDead();
                }
                else
                {
                    motionX *= -0.10000000149011612D;
                    motionY *= -0.10000000149011612D;
                    motionZ *= -0.10000000149011612D;
                    rotationYaw += 180F;
                    prevRotationYaw += 180F;
                    ticksInAir = 0;
                }
            }
            else
            {
                xTile = movingobjectposition.blockX;
                yTile = movingobjectposition.blockY;
                zTile = movingobjectposition.blockZ;
                inTile = worldObj.getBlockId(xTile, yTile, zTile);
                inData = worldObj.getBlockMetadata(xTile, yTile, zTile);
                motionX = (float)(movingobjectposition.hitVec.xCoord - posX);
                motionY = (float)(movingobjectposition.hitVec.yCoord - posY);
                motionZ = (float)(movingobjectposition.hitVec.zCoord - posZ);
                float f2 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
                posX -= (motionX / (double)f2) * 0.05000000074505806D;
                posY -= (motionY / (double)f2) * 0.05000000074505806D;
                posZ -= (motionZ / (double)f2) * 0.05000000074505806D;
                worldObj.playSoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
                inGround = true;
                arrowShake = 7;
                arrowCritical = false;
            }
        }

        if (arrowCritical)
        {
            for (int i1 = 0; i1 < 4; i1++)
            {
                worldObj.spawnParticle("crit", posX + (motionX * (double)i1) / 4D, posY + (motionY * (double)i1) / 4D, posZ + (motionZ * (double)i1) / 4D, -motionX, -motionY + 0.20000000000000001D, -motionZ);
            }
        }

        posX += motionX;
        posY += motionY;
        posZ += motionZ;
        float f3 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
        rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);

        for (rotationPitch = (float)((Math.atan2(motionY, f3) * 180D) / Math.PI); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) { }

        for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) { }

        for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) { }

        for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) { }

        rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
        rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
        float f4 = 0.99F;
        float f6 = 0.05F;

        if (isInWater())
        {
            for (int k1 = 0; k1 < 4; k1++)
            {
                float f8 = 0.25F;
                worldObj.spawnParticle("bubble", posX - motionX * (double)f8, posY - motionY * (double)f8, posZ - motionZ * (double)f8, motionX, motionY, motionZ);
            }

            f4 = 0.8F;
        }

        motionX *= f4;
        motionY *= f4;
        motionZ *= f4;
        motionY -= f6;
        setPosition(posX, posY, posZ);
    }

    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    {
        par1NBTTagCompound.setShort("xTile", (short)xTile);
        par1NBTTagCompound.setShort("yTile", (short)yTile);
        par1NBTTagCompound.setShort("zTile", (short)zTile);
        par1NBTTagCompound.setByte("inTile", (byte)inTile);
        par1NBTTagCompound.setByte("inData", (byte)inData);
        par1NBTTagCompound.setByte("shake", (byte)arrowShake);
        par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
        par1NBTTagCompound.setBoolean("player", doesArrowBelongToPlayer);
        par1NBTTagCompound.setDouble("damage", damage);
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    {
        xTile = par1NBTTagCompound.getShort("xTile");
        yTile = par1NBTTagCompound.getShort("yTile");
        zTile = par1NBTTagCompound.getShort("zTile");
        inTile = par1NBTTagCompound.getByte("inTile") & 0xff;
        inData = par1NBTTagCompound.getByte("inData") & 0xff;
        arrowShake = par1NBTTagCompound.getByte("shake") & 0xff;
        inGround = par1NBTTagCompound.getByte("inGround") == 1;
        doesArrowBelongToPlayer = par1NBTTagCompound.getBoolean("player");

        if (par1NBTTagCompound.hasKey("damage"))
        {
            damage = par1NBTTagCompound.getDouble("damage");
        }
    }

    /**
     * Called by a player entity when they collide with an entity
     */
    public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
    {
        if (worldObj.isRemote)
        {
            return;
        }

        if (inGround && doesArrowBelongToPlayer && arrowShake <= 0 && par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1)))
        {
            worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            par1EntityPlayer.onItemPickup(this, 1);
            setDead();
        }
    }

    public float getShadowSize()
    {
        return 0.0F;
    }

    public void setDamage(double par1)
    {
        damage = par1;
    }

    public double getDamage()
    {
        return damage;
    }

    public void func_46023_b(int par1)
    {
        field_46027_au = par1;
    }

    /**
     * If returns false, the item will not inflict any damage against entities.
     */
    public boolean canAttackWithItem()
    {
        return false;
    }
}

 

 

RenderOlivineArrow

 

 

package net.minecraft.src;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;


public class RenderOlivineArrow extends Render
{
    public RenderOlivineArrow()
    {
    }
    public void renderArrow(EntityOlivineArrow par1EntityOlivineArrow, double par2, double par4, double par6, float par8, float par9)
    {
            loadTexture("/AdditionalOres/arrows/OlivineArrowRender.png");
            GL11.glPushMatrix();
            GL11.glTranslatef((float)par2, (float)par4, (float)par6);
            GL11.glRotatef((par1EntityOlivineArrow.prevRotationYaw + (par1EntityOlivineArrow.rotationYaw - par1EntityOlivineArrow.prevRotationYaw) * par9) - 90F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(par1EntityOlivineArrow.prevRotationPitch + (par1EntityOlivineArrow.rotationPitch - par1EntityOlivineArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
            Tessellator tessellator = Tessellator.instance;
            int i = 0;
            float f = 0.0F;
            float f1 = 0.5F;
            float f2 = (float)(0 + i * 10) / 32F;
            float f3 = (float)(5 + i * 10) / 32F;
            float f4 = 0.0F;
            float f5 = 0.15625F;
            float f6 = (float)(5 + i * 10) / 32F;
            float f7 = (float)(10 + i * 10) / 32F;
            float f8 = 0.05625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            float f9 = (float)par1EntityOlivineArrow.arrowShake - par9;
            if(f9 > 0.0F)
            {
                    float f10 = -MathHelper.sin(f9 * 3F) * f9;
                    GL11.glRotatef(f10, 0.0F, 0.0F, 1.0F);
            }
            GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(f8, f8, f8);
            GL11.glTranslatef(-4F, 0.0F, 0.0F);
            GL11.glNormal3f(f8, 0.0F, 0.0F);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-7D, -2D, -2D, f4, f6);
            tessellator.addVertexWithUV(-7D, -2D, 2D, f5, f6);
            tessellator.addVertexWithUV(-7D, 2D, 2D, f5, f7);
            tessellator.addVertexWithUV(-7D, 2D, -2D, f4, f7);
            tessellator.draw();
            GL11.glNormal3f(-f8, 0.0F, 0.0F);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-7D, 2D, -2D, f4, f6);
            tessellator.addVertexWithUV(-7D, 2D, 2D, f5, f6);
            tessellator.addVertexWithUV(-7D, -2D, 2D, f5, f7);
            tessellator.addVertexWithUV(-7D, -2D, -2D, f4, f7);
            tessellator.draw();
            for(int j = 0; j < 4; j++)
            {
                    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
                    GL11.glNormal3f(0.0F, 0.0F, f8);
                    tessellator.startDrawingQuads();
                    tessellator.addVertexWithUV(-8D, -2D, 0.0D, f, f2);
                    tessellator.addVertexWithUV(8D, -2D, 0.0D, f1, f2);
                    tessellator.addVertexWithUV(8D, 2D, 0.0D, f1, f3);
                    tessellator.addVertexWithUV(-8D, 2D, 0.0D, f, f3);
                    tessellator.draw();
            }
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            GL11.glPopMatrix();
    }
    /**
         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
         */
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
            renderArrow((EntityOlivineArrow)par1Entity, par2, par4, par6, par8, par9);
    }
}

 

 

ItemOlivineArrow;

 

 

package net.minecraft.src;
import java.util.Random;
import net.minecraft.src.forge.*;

public class ItemOlivineArrow extends Item implements ITextureProvider, IArrowLooseHandler
{

public ItemOlivineArrow(int x)
{
	super(x);
	maxStackSize = 64;
}

/*public ItemStack onArrowNock(ItemStack itemstack, World world, EntityPlayer player)
{
	if (itemstack.itemID == Item.bow.shiftedIndex)
	{
		return new ItemStack(mod_AdditionalOres.itemOlivineArrow, 1);
	}
	else
	{
		return null;
	}
}*/

public boolean onArrowLoose(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int var6)
    {

        boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;

        if (var5 || par3EntityPlayer.inventory.hasItem(mod_AdditionalOres.itemOlivineArrow.shiftedIndex))
        {
            //int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4;
            float var7 = (float)var6 / 20.0F;
            var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;

            if ((double)var7 < 0.1D)
            {
                return false;
            }

            if (var7 > 1.0F)
            {
                var7 = 1.0F;
            }

            EntityOlivineArrow var8 = new EntityOlivineArrow(par2World, par3EntityPlayer, var7 * 2.0F);

            if (var7 == 1.0F)
            {
                var8.arrowCritical = true;
            }

            int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);

            if (var9 > 0)
            {
                var8.setDamage(var8.getDamage() + (double)var9 * 0.5D + 0.5D);
            }

            int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);

            if (var10 > 0)
            {
                var8.func_46023_b(var10);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
            {
                var8.setFire(100);
            }

            par1ItemStack.damageItem(1, par3EntityPlayer);
            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F);

            if (!var5)
            {
                par3EntityPlayer.inventory.consumeInventoryItem(mod_AdditionalOres.itemOlivineArrow.shiftedIndex);
            }
            else
            {
                var8.doesArrowBelongToPlayer = false;
            }

            if (!par2World.isRemote)
            {
                par2World.spawnEntityInWorld(var8);
            }
        }
        
	return true;
    }
    



public String getTextureFile()
    {
	return "/AdditionalOres/ADItems.png";
    }

}

 

 

Am I missing something? We tried to up the size and damage of the arrow to ridiculous amounts(20D instead of 2D, 1.5F instead of 0.5F) to make sure if it's actually using the original Arrow, and it is.

 

I'd be ever-so-grateful for any help! :)

Link to comment
Share on other sites

  • 1 month later...

You need an entity render file. There are tutorials out then on how to render an entity.

 

First, there is a renderer file.

Second, can you show us how to use the IArrowNock and IArrowLoose handers? i would really appreciate it because cant figure out how they work and there is no tutorial on how to use them.

Link to comment
Share on other sites

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.