Jump to content

SilasOtoko

Members
  • Posts

    92
  • Joined

  • Last visited

Posts posted by SilasOtoko

  1. I cannot for the life of me figure out what I am missing. When I throw my custom entity, it works in all aspects except that it appears as a white cube. The texture for the item works, so my texture is good to go, I just can't seem to get my Entity to take on the texture.

     

     

    ItemCreeperHeart

     

     

    public class ItemCreeperHeart extends ItemRS {

    public ItemCreeperHeart(){

    super();

    this.maxStackSize = 16;

    this.setCreativeTab(RunesAndSilver.tabRunesAndSilver);

    this.setUnlocalizedName("CreeperHeart");

    this.setTextureName("CreeperHeart");

    }

     

    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 EntityCreeperHeart(par2World, par3EntityPlayer));

            }

     

            return par1ItemStack;

    }

    }

     

     

     

     

    EntityCreeperHeart

     

     

    public class EntityCreeperHeart extends EntityThrowable{

     

    public EntityCreeperHeart(World world) {

    super(world);

     

    }

     

    public EntityCreeperHeart(World par1World, EntityLivingBase par3EntityPlayer)

    {

    super(par1World, par3EntityPlayer);

    }

     

    @SideOnly(Side.CLIENT)

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

    {

    super(par1World, par2, par4, par6);

    }

     

     

    protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {

     

    float f = 3.0F;

     

    if(!this.worldObj.isRemote){

    boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");

    this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);

    this.setDead();

    }

     

    }

     

    }

     

     

     

     

    RenderCreeperHeart

     

     

    @SideOnly(Side.CLIENT)

    public class RenderCreeperHeart extends RenderSnowball

    {

    private static Item item;

     

    private int num;

       

    public RenderCreeperHeart(Item par1Item, int par2) {

    super(par1Item, par2);

    this.item = item;

    num = 2;

    }

    public RenderCreeperHeart(Item par1Item)

    {

    this(item, 0);

    }

     

    }

     

     

     

    ClientProxy

     

     

    public class ClientProxy extends CommonProxy{

     

    @Override

    public void registerRenderers(){

    RenderingRegistry.registerEntityRenderingHandler(EntityCreeperHeart.class, new RenderCreeperHeart(ModItems.CreeperHeart));

    }

    }

     

     

     

    CommonProxy

     

     

    public abstract class CommonProxy implements IProxy {

     

    public void registerRenderers() {

     

     

    }

     

    }

     

     

     

    Main Class

     

     

    @Mod.EventHandler

    public void preInit(FMLPreInitializationEvent event){

    ConfigurationHandler.init(event.getSuggestedConfigurationFile());

    FMLCommonHandler.instance().bus().register(new ConfigurationHandler());

     

    ModItems.init();

     

    EntityRegistry.registerModEntity(EntityCreeperHeart.class, "CreeperHeart", ++modEntityIndex, this, 64, 10, true);

    }

     

     

     

    For a great reference on making a custom Throwable Item, check out this guys post: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571527-forge-1-7-x-custom-item-with-throwable-entity

  2. The reason I gave all the code is because, like I said in the post, I do not have an idea which method is causing an issue. I'm not getting any sort of error in Eclipse from it. If I were able to pinpoint it down to exactly where I was having the issue and was able to more concisely identify the problem then I'd probably be able to figure it out on my own. I only asked if anyone was able to give any insight into it, maybe from personal experience or guesswork.

      I wish I could be more specific, but I can't. All I know is that my portal is not functioning like a portal should after the player passes through it into another dimension. The player does not spawn inside another portal like when using the vanilla portal.

  3. I'm having several issues here, and I can't seem to pinpoint the problem. When I use a custom portal to get to my custom dimension, I run into one of two problems. 1) The player spawns underground or somewhere else nearby. 2) The custom portal destroys itself or does not spawn a proper working portal in the next dimension after going through it. Third issue I am trying to fix is the portal that fills in the space between the frame is still breakable as individual blocks. Any help appreciated.

     

    Portal Block

     

    public class blockTeleporter extends BlockPortal{

    public blockTeleporter(int par1){

    super(par1);

     

    }

     

    public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){

    if(entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP){

    EntityPlayerMP player = (EntityPlayerMP) entity;

    MinecraftServer server = MinecraftServer.getServer();

     

    if(player.timeUntilPortal > 0){

    player.timeUntilPortal = 10;

    }else if(player.dimension != Main.dimensionIDRune2){

    player.timeUntilPortal = 10;

    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, Main.dimensionIDRune2, new TeleporterRuneDimension(server.worldServerForDimension(Main.dimensionIDRune2)));

    }else{

    player.timeUntilPortal = 10;

    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterRuneDimension(server.worldServerForDimension(Main.dimensionIDRune2)));

     

    }

    }

    }

     

    public boolean tryToCreatePortal(World world, int x, int y, int z){

     

    byte b = 0;

    byte b1 = 0;

     

    if(world.getBlockId(x-1, y, z) == Main.blockDimensionStone.blockID || world.getBlockId(x+1, y, z) == Main.blockDimensionStone.blockID){

    b = 1;

     

    }

     

    if(world.getBlockId(x, y, z-1) == Main.blockDimensionStone.blockID || world.getBlockId(x, y, z+1) == Main.blockDimensionStone.blockID){

    b1 = 1;

    }

     

    if(b == b1){

    return false;

    }else{

    if(world.isAirBlock(x-b, y, z-b1)){

    x-=b;

    z-=b1;

    }

     

    for(int i = -1; i <= 2; i++){

    for(int j = -1; j <= 3; j++){

    boolean flag = (i == -1 || i == 2 || j == -1 || j == 3);

     

    if(i != -1 && i != 2 || j != -1 && j != 3){

    int k = world.getBlockId(x + (b*i), y + j, z+(b1*i));

    boolean isAirBlock = world.isAirBlock(x + b*i, y+j, z + b1*i);

     

    if(flag){

    if(k != Main.blockDimensionStone.blockID){

    return false;

    }

    }else if(!isAirBlock && k != Main.RuneFire.blockID){

    return false;

    }

    }

    }

    }

     

    for(int l = 0; l < 2; l++){

    for(int l2 = 0; l2 < 3; l2++){

    world.setBlock(x + b*l, y + l2, z + b1*l, Main.blockTeleporter.blockID, 0, 2);

    }

    }

    return false;

    }

     

     

    }

     

    //@Override

    public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)

        {

            byte b0 = 0;

            byte b1 = 1;

     

            if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID)

            {

                b0 = 1;

                b1 = 0;

            }

     

            int i1;

     

            for (i1 = par3; par1World.getBlockId(par2, i1 - 1, par4) == this.blockID; --i1)

            {

                ;

            }

     

            if (par1World.getBlockId(par2, i1 - 1, par4) != Main.blockDimensionStone.blockID)

            {

                par1World.setBlockToAir(par2, par3, par4);

            }

            else

            {

                int j1;

     

                for (j1 = 1; j1 < 4 && par1World.getBlockId(par2, i1 + j1, par4) == this.blockID; ++j1)

                {

                    ;

                }

     

                if (j1 == 3 && par1World.getBlockId(par2, i1 + j1, par4) == Main.blockDimensionStone.blockID)

                {

                    boolean flag = par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID;

                    boolean flag1 = par1World.getBlockId(par2, par3, par4 - 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID;

     

                    if (flag && flag1)

                    {

                        par1World.setBlockToAir(par2, par3, par4);

                    }

                    else

                    {

                        if ((par1World.getBlockId(par2 + b0, par3, par4 + b1) != Main.blockDimensionStone.blockID || par1World.getBlockId(par2 - b0, par3, par4 - b1) != this.blockID) && (par1World.getBlockId(par2 - b0, par3, par4 - b1) != Main.blockDimensionStone.blockID || par1World.getBlockId(par2 + b0, par3, par4 + b1) != this.blockID))

                        {

                            par1World.setBlockToAir(par2, par3, par4);

                        }

                    }

                }

                else

                {

                    par1World.setBlockToAir(par2, par3, par4);

                }

            }

        }

     

     

    }

     

     

    Teleporter

     

    public class TeleporterRuneDimension extends Teleporter {

     

    private final WorldServer worldServerInstance;

    private final Random rand;

     

    private final LongHashMap destinationCoordinateCache = new LongHashMap();

    private final List destinationCoordinateKeys = new ArrayList();

     

    public TeleporterRuneDimension(WorldServer par1WorldServer){

    super(par1WorldServer);

     

    this.worldServerInstance = par1WorldServer;

    this.rand = new Random(par1WorldServer.getSeed());

    }

     

    public void placeInPortal(Entity entity, double x, double y, double z, float f){

    if(this.worldServerInstance.provider.dimensionId != 1){

    if(!this.placeInExistingPortal(entity, x, y, z, f)){

    this.makePortal(entity);

    this.placeInExistingPortal(entity, x, y, z, f);

     

    }else{

    int entity_x = MathHelper.floor_double(entity.posX);

    int entity_y = MathHelper.floor_double(entity.posY)-1;

    int entity_z = MathHelper.floor_double(entity.posZ);

    byte b0 = 1;

    byte b1 = 0;

     

    for(int i= -2; i <= 2; i++){

    for(int j = -2; j <= 2; j++){

    for(int k = -1; k < 3; k++){

    int x2 = entity_x + j*b0 + i*b1;

    int y2 = entity_y + k;

    int z2 = entity_z + j*b1 - 1*b0;

    boolean flag = k < 0;

    this.worldServerInstance.setBlock(x2, y2, z2, flag ? Main.blockDimensionStone.blockID : 0);

    }

    }

    }

     

    entity.setLocationAndAngles(entity_x, entity_y, entity_z, entity.rotationYaw, 0F);

    entity.motionX = entity.motionY = entity.motionZ = 0D;

    }

    }

    }

     

    @Override

    public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8)

        {

            short short1 = 128;

            double d3 = -1.0D;

            int i = 0;

            int j = 0;

            int k = 0;

            int l = MathHelper.floor_double(par1Entity.posX);

            int i1 = MathHelper.floor_double(par1Entity.posZ);

            long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);

            boolean flag = true;

            double d4;

            int k1;

     

            if (this.destinationCoordinateCache.containsItem(j1))

            {

                PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(j1);

                d3 = 0.0D;

                i = portalposition.posX;

                j = portalposition.posY;

                k = portalposition.posZ;

                portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();

                flag = false;

            }

            else

            {

                for (k1 = l - short1; k1 <= l + short1; ++k1)

                {

                    double d5 = (double)k1 + 0.5D - par1Entity.posX;

     

                    for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1)

                    {

                        double d6 = (double)l1 + 0.5D - par1Entity.posZ;

     

                        for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2)

                        {

                            if (this.worldServerInstance.getBlockId(k1, i2, l1) == Main.blockTeleporter.blockID)

                            {

                                while (this.worldServerInstance.getBlockId(k1, i2 - 1, l1) == Main.blockTeleporter.blockID)

                                {

                                    --i2;

                                }

     

                                d4 = (double)i2 + 0.5D - par1Entity.posY;

                                double d7 = d5 * d5 + d4 * d4 + d6 * d6;

     

                                if (d3 < 0.0D || d7 < d3)

                                {

                                    d3 = d7;

                                    i = k1;

                                    j = i2;

                                    k = l1;

                                }

                            }

                        }

                    }

                }

            }

     

            if (d3 >= 0.0D)

            {

                if (flag)

                {

                    this.destinationCoordinateCache.add(j1, new PortalPosition(this, i, j, k, this.worldServerInstance.getTotalWorldTime()));

                    this.destinationCoordinateKeys.add(Long.valueOf(j1));

                }

     

                double d8 = (double)i + 0.5D;

                double d9 = (double)j + 0.5D;

                d4 = (double)k + 0.5D;

                int j2 = -1;

     

                if (this.worldServerInstance.getBlockId(i - 1, j, k) == Main.blockTeleporter.blockID)

                {

                    j2 = 2;

                }

     

                if (this.worldServerInstance.getBlockId(i + 1, j, k) == Main.blockTeleporter.blockID)

                {

                    j2 = 0;

                }

     

                if (this.worldServerInstance.getBlockId(i, j, k - 1) == Main.blockTeleporter.blockID)

                {

                    j2 = 3;

                }

     

                if (this.worldServerInstance.getBlockId(i, j, k + 1) == Main.blockTeleporter.blockID)

                {

                    j2 = 1;

                }

     

                int k2 = par1Entity.getTeleportDirection();

     

                if (j2 > -1)

                {

                    int l2 = Direction.rotateLeft[j2];

                    int i3 = Direction.offsetX[j2];

                    int j3 = Direction.offsetZ[j2];

                    int k3 = Direction.offsetX[l2];

                    int l3 = Direction.offsetZ[l2];

                    boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3);

                    boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3);

     

                    if (flag1 && flag2)

                    {

                        j2 = Direction.rotateOpposite[j2];

                        l2 = Direction.rotateOpposite[l2];

                        i3 = Direction.offsetX[j2];

                        j3 = Direction.offsetZ[j2];

                        k3 = Direction.offsetX[l2];

                        l3 = Direction.offsetZ[l2];

                        k1 = i - k3;

                        d8 -= (double)k3;

                        int i4 = k - l3;

                        d4 -= (double)l3;

                        flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3);

                        flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3);

                    }

     

                    float f1 = 0.5F;

                    float f2 = 0.5F;

     

                    if (!flag1 && flag2)

                    {

                        f1 = 1.0F;

                    }

                    else if (flag1 && !flag2)

                    {

                        f1 = 0.0F;

                    }

                    else if (flag1 && flag2)

                    {

                        f2 = 0.0F;

                    }

     

                    d8 += (double)((float)k3 * f1 + f2 * (float)i3);

                    d4 += (double)((float)l3 * f1 + f2 * (float)j3);

                    float f3 = 0.0F;

                    float f4 = 0.0F;

                    float f5 = 0.0F;

                    float f6 = 0.0F;

     

                    if (j2 == k2)

                    {

                        f3 = 1.0F;

                        f4 = 1.0F;

                    }

                    else if (j2 == Direction.rotateOpposite[k2])

                    {

                        f3 = -1.0F;

                        f4 = -1.0F;

                    }

                    else if (j2 == Direction.rotateRight[k2])

                    {

                        f5 = 1.0F;

                        f6 = -1.0F;

                    }

                    else

                    {

                        f5 = -1.0F;

                        f6 = 1.0F;

                    }

     

                    double d10 = par1Entity.motionX;

                    double d11 = par1Entity.motionZ;

                    par1Entity.motionX = d10 * (double)f3 + d11 * (double)f6;

                    par1Entity.motionZ = d10 * (double)f5 + d11 * (double)f4;

                    par1Entity.rotationYaw = par8 - (float)(k2 * 90) + (float)(j2 * 90);

                }

                else

                {

                    par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;

                }

     

                par1Entity.setLocationAndAngles(d8, d9, d4, par1Entity.rotationYaw, par1Entity.rotationPitch);

                return true;

            }

            else

            {

                return false;

            }

        }

     

    public boolean makePortal(Entity par1Entity)

        {

            byte b0 = 16;

            double d0 = -1.0D;

            int i = MathHelper.floor_double(par1Entity.posX);

            int j = MathHelper.floor_double(par1Entity.posY);

            int k = MathHelper.floor_double(par1Entity.posZ);

            int l = i;

            int i1 = j;

            int j1 = k;

            int k1 = 0;

            int l1 = this.rand.nextInt(4);

            int i2;

            double d1;

            double d2;

            int j2;

            int k2;

            int l2;

            int i3;

            int j3;

            int k3;

            int l3;

            int i4;

            int j4;

            int k4;

            double d3;

            double d4;

     

            for (i2 = i - b0; i2 <= i + b0; ++i2)

            {

                d1 = (double)i2 + 0.5D - par1Entity.posX;

     

                for (j2 = k - b0; j2 <= k + b0; ++j2)

                {

                    d2 = (double)j2 + 0.5D - par1Entity.posZ;

                    label274:

     

                    for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)

                    {

                        if (this.worldServerInstance.isAirBlock(i2, k2, j2))

                        {

                            while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))

                            {

                                --k2;

                            }

     

                            for (i3 = l1; i3 < l1 + 4; ++i3)

                            {

                                l2 = i3 % 2;

                                k3 = 1 - l2;

     

                                if (i3 % 4 >= 2)

                                {

                                    l2 = -l2;

                                    k3 = -k3;

                                }

     

                                for (j3 = 0; j3 < 3; ++j3)

                                {

                                    for (i4 = 0; i4 < 4; ++i4)

                                    {

                                        for (l3 = -1; l3 < 4; ++l3)

                                        {

                                            k4 = i2 + (i4 - 1) * l2 + j3 * k3;

                                            j4 = k2 + l3;

                                            int l4 = j2 + (i4 - 1) * k3 - j3 * l2;

     

                                            if (l3 < 0 && !this.worldServerInstance.getBlockMaterial(k4, j4, l4).isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4))

                                            {

                                                continue label274;

                                            }

                                        }

                                    }

                                }

     

                                d4 = (double)k2 + 0.5D - par1Entity.posY;

                                d3 = d1 * d1 + d4 * d4 + d2 * d2;

     

                                if (d0 < 0.0D || d3 < d0)

                                {

                                    d0 = d3;

                                    l = i2;

                                    i1 = k2;

                                    j1 = j2;

                                    k1 = i3 % 4;

                                }

                            }

                        }

                    }

                }

            }

     

            if (d0 < 0.0D)

            {

                for (i2 = i - b0; i2 <= i + b0; ++i2)

                {

                    d1 = (double)i2 + 0.5D - par1Entity.posX;

     

                    for (j2 = k - b0; j2 <= k + b0; ++j2)

                    {

                        d2 = (double)j2 + 0.5D - par1Entity.posZ;

                        label222:

     

                        for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)

                        {

                            if (this.worldServerInstance.isAirBlock(i2, k2, j2))

                            {

                                while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))

                                {

                                    --k2;

                                }

     

                                for (i3 = l1; i3 < l1 + 2; ++i3)

                                {

                                    l2 = i3 % 2;

                                    k3 = 1 - l2;

     

                                    for (j3 = 0; j3 < 4; ++j3)

                                    {

                                        for (i4 = -1; i4 < 4; ++i4)

                                        {

                                            l3 = i2 + (j3 - 1) * l2;

                                            k4 = k2 + i4;

                                            j4 = j2 + (j3 - 1) * k3;

     

                                            if (i4 < 0 && !this.worldServerInstance.getBlockMaterial(l3, k4, j4).isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4))

                                            {

                                                continue label222;

                                            }

                                        }

                                    }

     

                                    d4 = (double)k2 + 0.5D - par1Entity.posY;

                                    d3 = d1 * d1 + d4 * d4 + d2 * d2;

     

                                    if (d0 < 0.0D || d3 < d0)

                                    {

                                        d0 = d3;

                                        l = i2;

                                        i1 = k2;

                                        j1 = j2;

                                        k1 = i3 % 2;

                                    }

                                }

                            }

                        }

                    }

                }

            }

     

            int i5 = l;

            int j5 = i1;

            j2 = j1;

            int k5 = k1 % 2;

            int l5 = 1 - k5;

     

            if (k1 % 4 >= 2)

            {

                k5 = -k5;

                l5 = -l5;

            }

     

            boolean flag;

     

            if (d0 < 0.0D)

            {

                if (i1 < 70)

                {

                    i1 = 70;

                }

     

                if (i1 > this.worldServerInstance.getActualHeight() - 10)

                {

                    i1 = this.worldServerInstance.getActualHeight() - 10;

                }

     

                j5 = i1;

     

                for (k2 = -1; k2 <= 1; ++k2)

                {

                    for (i3 = 1; i3 < 3; ++i3)

                    {

                        for (l2 = -1; l2 < 3; ++l2)

                        {

                            k3 = i5 + (i3 - 1) * k5 + k2 * l5;

                            j3 = j5 + l2;

                            i4 = j2 + (i3 - 1) * l5 - k2 * k5;

                            flag = l2 < 0;

                            this.worldServerInstance.setBlock(k3, j3, i4, flag ? Main.blockDimensionStone.blockID : 0);

                        }

                    }

                }

            }

     

            for (k2 = 0; k2 < 4; ++k2)

            {

                for (i3 = 0; i3 < 4; ++i3)

                {

                    for (l2 = -1; l2 < 4; ++l2)

                    {

                        k3 = i5 + (i3 - 1) * k5;

                        j3 = j5 + l2;

                        i4 = j2 + (i3 - 1) * l5;

                        flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;

                        this.worldServerInstance.setBlock(k3, j3, i4, flag ? Main.blockDimensionStone.blockID : Main.blockTeleporter.blockID, 0, 2);

                    }

                }

     

                for (i3 = 0; i3 < 4; ++i3)

                {

                    for (l2 = -1; l2 < 4; ++l2)

                    {

                        k3 = i5 + (i3 - 1) * k5;

                        j3 = j5 + l2;

                        i4 = j2 + (i3 - 1) * l5;

                        this.worldServerInstance.notifyBlocksOfNeighborChange(k3, j3, i4, this.worldServerInstance.getBlockId(k3, j3, i4));

                    }

                }

            }

     

            return true;

        }

     

    public void removeStalePortalLocations(long par1)

        {

            if (par1 % 100L == 0L)

            {

                Iterator iterator = this.destinationCoordinateKeys.iterator();

                long j = par1 - 600L;

     

                while (iterator.hasNext())

                {

                    Long olong = (Long)iterator.next();

                    PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue());

     

                    if (portalposition == null || portalposition.lastUpdateTime < j)

                    {

                        iterator.remove();

                        this.destinationCoordinateCache.remove(olong.longValue());

                    }

                }

            }

        }

     

     

    }

     

     

  4. I have several custom Golems, the first of which works fine, but the other two have glitches when attacking. When I am attacked by one, it's arms will become stuck in a half raised position. Not only this, but ALL of the custom Golems move their arms in unison to each other like some sort of weird synchronized ballet. I cannot figure out why one of my Golem types work but not the other, even after comparing the code. Any help?

     

    Custom Golem that does not work:

     

     

    Entity:

     

    package runes.Runes;

     

    import net.minecraft.block.Block;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.entity.SharedMonsterAttributes;

    import net.minecraft.entity.ai.EntityAIAttackOnCollide;

    import net.minecraft.entity.ai.EntityAIHurtByTarget;

    import net.minecraft.entity.ai.EntityAILookIdle;

    import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;

    import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;

    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

    import net.minecraft.entity.ai.EntityAIWander;

    import net.minecraft.entity.ai.EntityAIWatchClosest;

    import net.minecraft.entity.monster.EntityMob;

    import net.minecraft.entity.monster.IMob;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.item.ItemStack;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.util.DamageSource;

    import net.minecraft.util.MathHelper;

    import net.minecraft.world.World;

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    public class EntityRuneGolem extends EntityMob {

    private int attackTimer;

        private int homeCheckTimer = 0;

       

     

    public EntityRuneGolem(World par1World){

    super(par1World);

            this.setSize(1.4F, 2.9F);

            this.getNavigator().setAvoidsWater(true);

            this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true));

            this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F));

            this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));

            this.tasks.addTask(6, new EntityAIWander(this, 0.6D));

            this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

            this.tasks.addTask(8, new EntityAILookIdle(this));

            this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));

            this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

    }

     

        protected void entityInit()

        {

            super.entityInit();

                this.dataWatcher.addObject(19, new Byte((byte)0));

                this.dataWatcher.addObject(20, new Byte((byte)0));

        }

       

        /**

        * (abstract) Protected helper method to write subclass entity data to NBT.

        */

        public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

        {

            super.writeEntityToNBT(par1NBTTagCompound);

         

        }

     

        /**

        * (abstract) Protected helper method to read subclass entity data from NBT.

        */

        public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

        {

            super.readEntityFromNBT(par1NBTTagCompound);

     

        }

     

        /**

        * Returns true if the newer Entity AI code should be run

        */

        public boolean isAIEnabled()

        {

            return true;

        }

     

        /**

        * main AI tick function, replaces updateEntityActionState

        */

        protected void updateAITick()

        {

            super.updateAITick();

        }

     

        @Override

        protected void applyEntityAttributes()

        {

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(50.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); //Recomended speed

     

        }

     

        /**

        * Decrements the entity's air supply when underwater

        */

        protected int decreaseAirSupply(int par1)

        {

            return par1;

        }

     

        @Override

        /**

        * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons

        * use this to react to sunlight and start to burn.

        */

        public void onLivingUpdate()

        {

            super.onLivingUpdate();

     

            if (this.attackTimer > 0)

            {

                --this.attackTimer;

            }

     

            if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0)

            {

                int i = MathHelper.floor_double(this.posX);

                int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);

                int k = MathHelper.floor_double(this.posZ);

                int l = this.worldObj.getBlockId(i, j, k);

     

                if (l > 0)

                {

                    this.worldObj.spawnParticle("tilecrack_" + l + "_" + this.worldObj.getBlockMetadata(i, j, k), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D);

                }

            }

           

        }

     

        /**

        * Returns true if this entity can attack entities of the specified class.

        */

        @Override

        public boolean canAttackClass(Class par1Class)

        {

        return super.canAttackClass(par1Class);

        }

       

        protected void collideWithEntity(Entity par1Entity)

        {

            if (par1Entity instanceof IMob && this.getRNG().nextInt(20) == 0)

            {

                this.setAttackTarget((EntityLivingBase)par1Entity);

            }

     

            super.collideWithEntity(par1Entity);

        }

     

       

     

        public boolean attackEntityAsMob(Entity par1Entity)

        {

            this.attackTimer = 10;

            this.worldObj.setEntityState(this, (byte)4);

            boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));

     

            if (flag)

            {

                par1Entity.motionY += 0.4000000059604645D;

            }

     

            this.playSound("mob.irongolem.throw", 1.0F, 1.0F);

            return flag;

        }

     

        @SideOnly(Side.CLIENT)

        public void handleHealthUpdate(byte par1)

        {

            if (par1 == 4)

            {

                this.attackTimer = 10;

                this.playSound("mob.irongolem.throw", 1.0F, 1.0F);

            }

            else

            {

                super.handleHealthUpdate(par1);

            }

        }

     

        @SideOnly(Side.CLIENT)

        public int getAttackTimer()

        {

            return this.attackTimer;

        }

     

        /**

        * Returns the sound this mob makes while it's alive.

        */

        protected String getLivingSound()

        {

            return "none";

        }

     

        /**

        * Returns the sound this mob makes when it is hurt.

        */

        protected String getHurtSound()

        {

            return "mob.irongolem.hit";

        }

     

        /**

        * Returns the sound this mob makes on death.

        */

        protected String getDeathSound()

        {

            return "mob.irongolem.death";

        }

     

        /**

        * Plays step sound at given x, y, z for the entity

        */

        protected void playStepSound(int par1, int par2, int par3, int par4)

        {

            this.playSound("mob.irongolem.walk", 1.0F, 1.0F);

        }

     

        /**

        * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param

        * par2 - Level of Looting used to kill this mob.

        */

        protected void dropFewItems(boolean par1, int par2)

        {

            int j = this.rand.nextInt(3);

            int k;

     

            for (k = 0; k < j; ++k)

            {

                this.dropItem(Main.Rune.itemID, 2);

            }

     

            k = 3 + this.rand.nextInt(3);

     

            for (int l = 0; l < k; ++l)

            {

                this.dropItem(Main.SilverEssence.itemID, 2);

            }

        }

       

     

        /**

        * Called when the mob's health reaches 0.

        */

        public void onDeath(DamageSource par1DamageSource)

        {

            super.onDeath(par1DamageSource);

        }

     

        protected boolean canDespawn()

        {

            return true;

        }

     

        public int getMaxSpawnedInChunk()

        {

            return 1;

        }

     

    public void initCreature() {

    }

     

     

     

    protected void addRandomArmor()

        {

            super.addRandomArmor();

     

            if (this.rand.nextFloat() < (this.worldObj.difficultySetting == 3 ? 0.05F : 0.01F))

            {

                int i = this.rand.nextInt(3);

     

                if (i == 0)

                {

                    this.setCurrentItemOrArmor(0, new ItemStack(Block.plantYellow));

                }

                else

                {

                    this.setCurrentItemOrArmor(0, new ItemStack(Block.plantRed));

                }

            }

        }

     

     

     

    }

     

    Render:

     

    package runes.Runes;

     

    import net.minecraft.client.renderer.entity.RenderLiving;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.util.ResourceLocation;

     

    import org.lwjgl.opengl.GL11;

     

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    @SideOnly(Side.CLIENT)

    public class RenderRuneGolem extends RenderLiving

    {

    /** Iron Golem's Model. */

        protected ModelRuneGolem model;

     

        public RenderRuneGolem(ModelRuneGolem par1model, float f)

        {

            super(par1model, f);

            model = (ModelRuneGolem)mainModel;

        }

     

        public void doRenderRuneGolem(EntityRuneGolem par1EntityEnt, double par2, double par4, double par6, float par8, float par9)

        {

       

            super.doRenderLiving(par1EntityEnt, par2, par4, par6, par8, par9);

        }

     

        /**

        * Rotates Iron Golem corpse.

        */

        protected void rotateRuneGolemCorpse(EntityRuneGolem par1EntityEnt, float par2, float par3, float par4)

        {

            super.rotateCorpse(par1EntityEnt, par2, par3, par4);

     

            if ((double)par1EntityEnt.limbSwingAmount >= 0.01D)

            {

                float f3 = 13.0F;

                float f4 = par1EntityEnt.limbSwing - par1EntityEnt.limbSwingAmount * (1.0F - par4) + 6.0F;

                float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F);

                GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F);

            }

        }

     

        /*protected void RenderRuneGolemEquippedItems(EntityRuneGolem par1EntityEnt, float par2)

        {

            super.renderEquippedItems(par1EntityEnt, par2);

     

           

        }*/

       

     

       

     

        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderRuneGolem((EntityRuneGolem)par1EntityLiving, par2, par4, par6, par8, par9);

        }

     

        /*protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)

        {

            this.RenderRuneGolemEquippedItems((EntityRuneGolem)par1EntityLivingBase, par2);

           

        }*/

       

        protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)

        {

            this.rotateRuneGolemCorpse((EntityRuneGolem)par1EntityLivingBase, par2, par3, par4);

        }

     

        public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderRuneGolem((EntityRuneGolem)par1EntityLivingBase, par2, par4, par6, par8, par9);

        }

     

        /**

        * 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.

        */

        @Override

        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderRuneGolem((EntityRuneGolem)par1Entity, par2, par4, par6, par8, par9);

        }

     

    @Override

    protected ResourceLocation getEntityTexture(Entity entity) {

    return new ResourceLocation("runes:textures/entity/RuneGolem.png");

    }

    }

     

     

    Model:

     

    package runes.Runes;

     

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelRenderer;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLivingBase;

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    @SideOnly(Side.CLIENT)

    public class ModelRuneGolem extends ModelBase

    {

        /** The head model for the iron golem. */

        public ModelRenderer runeGolemHead;

     

        /** The body model for the iron golem. */

        public ModelRenderer runeGolemBody;

     

        /** The right arm model for the iron golem. */

        public ModelRenderer runeGolemRightArm;

     

        /** The left arm model for the iron golem. */

        public ModelRenderer runeGolemLeftArm;

     

        /** The left leg model for the Iron Golem. */

        public ModelRenderer runeGolemLeftLeg;

     

        /** The right leg model for the Iron Golem. */

        public ModelRenderer runeGolemRightLeg;

     

        public ModelRuneGolem()

        {

            this(0.0F);

        }

     

        public ModelRuneGolem(float par1)

        {

            this(par1, -7.0F);

        }

     

        public ModelRuneGolem(float par1, float par2)

        {

            short short1 = 128;

            short short2 = 128;

            this.runeGolemHead = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.runeGolemHead.setRotationPoint(0.0F, 0.0F + par2, -2.0F);

            this.runeGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, par1);

            this.runeGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, par1);

            this.runeGolemBody = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.runeGolemBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);

            this.runeGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1);

            this.runeGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F);

            this.runeGolemRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.runeGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F);

            this.runeGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1);

            this.runeGolemLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.runeGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F);

            this.runeGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1);

            this.runeGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);

            this.runeGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F);

            this.runeGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);

            this.runeGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);

            this.runeGolemRightLeg.mirror = true;

            this.runeGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F);

            this.runeGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);

        }

     

        /**

        * Sets the models various rotation angles then renders the model.

        */

        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)

        {

            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);

            this.runeGolemHead.render(par7);

            this.runeGolemBody.render(par7);

            this.runeGolemLeftLeg.render(par7);

            this.runeGolemRightLeg.render(par7);

            this.runeGolemRightArm.render(par7);

            this.runeGolemLeftArm.render(par7);

        }

     

        /**

        * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms

        * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how

        * "far" arms and legs can swing at most.

        */

        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)

        {

            this.runeGolemHead.rotateAngleY = par4 / (180F / (float)Math.PI);

            this.runeGolemHead.rotateAngleX = par5 / (180F / (float)Math.PI);

            this.runeGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;

            this.runeGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;

            this.runeGolemLeftLeg.rotateAngleY = 0.0F;

            this.runeGolemRightLeg.rotateAngleY = 0.0F;

        }

     

        /**

        * Used for easily adding entity-dependent animations. The second and third float params here are the same second

        * and third as in the setRotationAngles method.

        */

        public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)

        {

            EntityRuneGolem EntityRuneGolem = (EntityRuneGolem)par1EntityLivingBase;

            int i = EntityRuneGolem.getAttackTimer();

     

            if (i > 0)

            {

                this.runeGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);

                this.runeGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);

            }

            /*else

            {

                int j = EntityRuneGolem.getHoldRoseTick();

     

                if (j > 0)

                {

                    this.runeGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)j, 70.0F);

                    this.runeGolemLeftArm.rotateAngleX = 0.0F;

                }

                else

                {

                    this.runeGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;

                    this.runeGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;

                }

            }*/

        }

     

        private float func_78172_a(float par1, float par2)

        {

            return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);

        }

     

    }

     

     

    ClientProxy:

     

    package runes.Runes;

     

    import net.minecraft.client.model.ModelZombie;

    import cpw.mods.fml.client.registry.RenderingRegistry;

     

    public class ClientProxy extends CommonProxy{

    @Override

    public void registerRenderers(){

    RenderingRegistry.registerEntityRenderingHandler(EntityForestWalker.class, new RenderEnt(new ModelEnt(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityCreeperHeart.class, new RenderCreeperHeart(Main.CreeperHeart));

    RenderingRegistry.registerEntityRenderingHandler(EntityFireTalisman.class, new RenderFireTalisman(Main.FireTalisman));

    RenderingRegistry.registerEntityRenderingHandler(EntityWaterTalisman.class, new RenderWaterTalisman(Main.WaterTalisman));

    RenderingRegistry.registerEntityRenderingHandler(EntityEarthTalisman.class, new RenderEarthTalisman(Main.EarthTalisman));

    RenderingRegistry.registerEntityRenderingHandler(EntityEnderChild.class, new RenderEnderChild(new ModelEnderChild(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityRuneArrow.class, new RenderRuneArrow());

    RenderingRegistry.registerEntityRenderingHandler(EntityWaterBall.class, new RenderWaterBall(Main.WaterBall));

    RenderingRegistry.registerEntityRenderingHandler(EntityForestWalkerPC.class, new RenderForestWalkerPC(new ModelForestWalkerPC(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityEskimoZombie.class, new RenderEskimoZombie(new ModelEskimoZombie(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityEskimoSkeleton.class, new RenderEskimoSkeleton(new ModelEskimoZombie(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityYeti.class, new RenderYeti(new ModelYeti(), 0.3F));

    RenderingRegistry.registerEntityRenderingHandler(EntityPineCone.class, new RenderPineCone(Main.PineCone));

    RenderingRegistry.registerEntityRenderingHandler(EntityFairy.class, new RenderFairy(new ModelFairy(), 0.25F));

    RenderingRegistry.registerEntityRenderingHandler(EntityRuneGolem.class, new RenderRuneGolem(new ModelRuneGolem(), 0.3F));

    }

     

    @Override

     

    public int addArmor(String armor)

    {

    return RenderingRegistry.addNewArmourRendererPrefix(armor);

    }

    }

     

     

    Main:

     

    EntityRegistry.registerGlobalEntityID(EntityRuneGolem.class, "RuneGolem", 114);

        EntityRegistry.addSpawn(EntityRuneGolem.class, 2, 1, 1, EnumCreatureType.monster, RuneBiome);

        EntityRegistry.findGlobalUniqueEntityId();

        RegisterEntityEgg(EntityRuneGolem.class, 0, 0);

     

     

     

     

    Custom Golem that works fine:

     

     

    Entity:

     

    package runes.Runes;

     

    import java.util.List;

     

    import net.minecraft.block.Block;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityAgeable;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.SharedMonsterAttributes;

    import net.minecraft.entity.ai.EntityAIAttackOnCollide;

    import net.minecraft.entity.ai.EntityAIHurtByTarget;

    import net.minecraft.entity.ai.EntityAILookIdle;

    import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;

    import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;

    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

    import net.minecraft.entity.ai.EntityAIWander;

    import net.minecraft.entity.ai.EntityAIWatchClosest;

    import net.minecraft.entity.monster.EntityCreeper;

    import net.minecraft.entity.monster.IMob;

    import net.minecraft.entity.passive.EntityAnimal;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.item.ItemStack;

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.util.DamageSource;

    import net.minecraft.util.MathHelper;

    import net.minecraft.world.World;

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    public class EntityForestWalker extends EntityAnimal {

    private int attackTimer;

        private int homeCheckTimer = 0;

        public static boolean[] plantableBlocks = new boolean[4096];

     

    public EntityForestWalker(World par1World){

    super(par1World);

            this.setSize(1.4F, 2.9F);

            this.getNavigator().setAvoidsWater(true);

            this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true));

            this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F));

            this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));

            this.tasks.addTask(6, new EntityAIWander(this, 0.6D));

            this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

            this.tasks.addTask(8, new EntityAILookIdle(this));

            this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));

            this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));

    }

     

        protected void entityInit()

        {

            super.entityInit();

                this.dataWatcher.addObject(19, new Byte((byte)0));

                this.dataWatcher.addObject(20, new Byte((byte)0));

        }

       

        /**

        * (abstract) Protected helper method to write subclass entity data to NBT.

        */

        public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

        {

            super.writeEntityToNBT(par1NBTTagCompound);

            par1NBTTagCompound.setShort("carried", (short)this.getCarried());

            par1NBTTagCompound.setShort("carriedData", (short)this.getCarryingData());

        }

     

        /**

        * (abstract) Protected helper method to read subclass entity data from NBT.

        */

        public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

        {

            super.readEntityFromNBT(par1NBTTagCompound);

            this.setCarried(par1NBTTagCompound.getShort("carried"));

            this.setCarryingData(par1NBTTagCompound.getShort("carriedData"));

        }

     

        /**

        * Returns true if the newer Entity AI code should be run

        */

        public boolean isAIEnabled()

        {

            return true;

        }

     

        /**

        * main AI tick function, replaces updateEntityActionState

        */

        protected void updateAITick()

        {

            super.updateAITick();

        }

     

        @Override

        protected void applyEntityAttributes()

        {

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(100.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); //Recomended speed

        //this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(15D);

      // this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(20D);

        }

     

        /**

        * Decrements the entity's air supply when underwater

        */

        protected int decreaseAirSupply(int par1)

        {

            return par1;

        }

     

        protected void collideWithEntity(Entity par1Entity)

        {

            if (par1Entity instanceof IMob && !(par1Entity instanceof EntityForestWalker) && !(par1Entity instanceof EntityCreeper) && this.getRNG().nextInt(20) == 0)

            {

                this.setAttackTarget((EntityLiving)par1Entity);

            }

     

            super.collideWithEntity(par1Entity);

        }

     

        /**

        * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons

        * use this to react to sunlight and start to burn.

        */

        public void onLivingUpdate()

        {

           

     

            if (this.attackTimer > 0)

            {

                --this.attackTimer;

            }

     

            if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0)

            {

                int i = MathHelper.floor_double(this.posX);

                int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);

                int k = MathHelper.floor_double(this.posZ);

                int l = this.worldObj.getBlockId(i, j, k);

     

                if (l > 0)

                {

                    this.worldObj.spawnParticle("tilecrack_" + l + "_" + this.worldObj.getBlockMetadata(i, j, k), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D);

                }

            }

            int i;

     

            if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"))

            {

                int j;

                int k;

                int l;

     

                if (this.getCarried() == 0)

                {

                    if (this.rand.nextInt(20) == 0)

                    {

                        i = MathHelper.floor_double(this.posX - 2.0D + this.rand.nextDouble() * 4.0D);

                        j = MathHelper.floor_double(this.posY + this.rand.nextDouble() * 3.0D);

                        k = MathHelper.floor_double(this.posZ - 2.0D + this.rand.nextDouble() * 4.0D);

                        l = this.worldObj.getBlockId(i, j, k);

     

                        if (plantableBlocks[l])

                        {

                            this.setCarried(this.worldObj.getBlockId(i, j, k));

                            this.setCarryingData(this.worldObj.getBlockMetadata(i, j, k));

                            this.worldObj.setBlock(i, j, k, 0);

                        }

                    }

                }

                else if (this.rand.nextInt(2000) == 0)

                {

                    i = MathHelper.floor_double(this.posX - 1.0D + this.rand.nextDouble() * 2.0D);

                    j = MathHelper.floor_double(this.posY + this.rand.nextDouble() * 2.0D);

                    k = MathHelper.floor_double(this.posZ - 1.0D + this.rand.nextDouble() * 2.0D);

                    l = this.worldObj.getBlockId(i, j, k);

                    int i1 = this.worldObj.getBlockId(i, j - 1, k);

     

                    if (l == 0 && i1 > 0 && Block.blocksList[i1].renderAsNormalBlock())

                    {

                        this.worldObj.setBlock(i, j, k, this.getCarried(), this.getCarryingData(), 3);

                        this.setCarried(0);

                    }

                }

            }

            super.onLivingUpdate();

        }

     

        /**

        * Returns true if this entity can attack entities of the specified class.

        */

        @Override

        public boolean canAttackClass(Class par1Class)

        {

            return EntityForestWalker.class != par1Class && EntityCreeper.class != par1Class;

        }

     

       

     

        public boolean attackEntityAsMob(Entity par1Entity)

        {

            this.attackTimer = 10;

            this.worldObj.setEntityState(this, (byte)4);

            boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));

     

            if (flag)

            {

                par1Entity.motionY += 0.4000000059604645D;

            }

     

            this.playSound("mob.irongolem.throw", 1.0F, 1.0F);

            return flag;

        }

     

        @SideOnly(Side.CLIENT)

        public void handleHealthUpdate(byte par1)

        {

            if (par1 == 4)

            {

                this.attackTimer = 10;

                this.playSound("mob.irongolem.throw", 1.0F, 1.0F);

            }

            else

            {

                super.handleHealthUpdate(par1);

            }

        }

     

        @SideOnly(Side.CLIENT)

        public int getAttackTimer()

        {

            return this.attackTimer;

        }

     

        /**

        * Returns the sound this mob makes while it's alive.

        */

        protected String getLivingSound()

        {

            return "none";

        }

     

        /**

        * Returns the sound this mob makes when it is hurt.

        */

        protected String getHurtSound()

        {

            return "mob.irongolem.hit";

        }

     

        /**

        * Returns the sound this mob makes on death.

        */

        protected String getDeathSound()

        {

            return "mob.irongolem.death";

        }

     

        /**

        * Plays step sound at given x, y, z for the entity

        */

        protected void playStepSound(int par1, int par2, int par3, int par4)

        {

            this.playSound("mob.irongolem.walk", 1.0F, 1.0F);

        }

     

        /**

        * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param

        * par2 - Level of Looting used to kill this mob.

        */

        protected void dropFewItems(boolean par1, int par2)

        {

            int j = this.rand.nextInt(3);

            int k;

     

            for (k = 0; k < j; ++k)

            {

                this.dropItem(Main.EarthRune.itemID, 2);

            }

     

            k = 3 + this.rand.nextInt(3);

     

            for (int l = 0; l < k; ++l)

            {

                this.dropItem(Main.SilverEssence.itemID, 2);

            }

        }

       

        /**

        * Set the id of the block an enderman carries

        */

        public void setCarried(int par1)

        {

            this.dataWatcher.updateObject(19, Byte.valueOf((byte)(par1 & 255)));

        }

     

        /**

        * Get the id of the block an enderman carries

        */

        public int getCarried()

        {

            return this.dataWatcher.getWatchableObjectByte(19);

        }

     

        /**

        * Set the metadata of the block an enderman carries

        */

        public void setCarryingData(int par1)

        {

            this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 255)));

        }

     

        /**

        * Get the metadata of the block an enderman carries

        */

        public int getCarryingData()

        {

            return this.dataWatcher.getWatchableObjectByte(20);

        }

     

        /**

        * Called when the mob's health reaches 0.

        */

        public void onDeath(DamageSource par1DamageSource)

        {

            super.onDeath(par1DamageSource);

        }

     

        protected boolean canDespawn()

        {

            return true;

        }

     

        public int getMaxSpawnedInChunk()

        {

            return 1;

        }

     

    public void initCreature() {

    }

     

    static

        {

            plantableBlocks[block.sapling.blockID] = true;

            plantableBlocks[block.plantYellow.blockID] = true;

            plantableBlocks[block.plantRed.blockID] = true;

            plantableBlocks[block.mushroomBrown.blockID] = true;

            plantableBlocks[block.mushroomRed.blockID] = true;

            plantableBlocks[block.cactus.blockID] = true;

            plantableBlocks[block.pumpkin.blockID] = true;

            plantableBlocks[block.melon.blockID] = true;

        }

     

    protected void addRandomArmor()

        {

            super.addRandomArmor();

     

            if (this.rand.nextFloat() < (this.worldObj.difficultySetting == 3 ? 0.05F : 0.01F))

            {

                int i = this.rand.nextInt(3);

     

                if (i == 0)

                {

                    this.setCurrentItemOrArmor(0, new ItemStack(Block.sapling));

                }

                else

                {

                    this.setCurrentItemOrArmor(0, new ItemStack(Block.plantRed));

                }

            }

        }

     

    @Override

    public EntityAgeable createChild(EntityAgeable entityageable) {

    // TODO Auto-generated method stub

    return null;

    }

     

    /*@Override

    public boolean getCanSpawnHere()

        {

    float f = 8.0F;

            List list;

            int i;

           

     

                list = this.worldObj.getEntitiesWithinAABB(EntityForestWalker.class, this.boundingBox.expand((double)f, (double)f, (double)f));

     

                if (list.size() > 0){

                return false;

                }

                else

                {

                return true;

                }

     

        }  */

    }

     

     

    Render:

     

    package runes.Runes;

     

    import net.minecraft.block.Block;

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelIronGolem;

    import net.minecraft.client.model.ModelQuadruped;

    import net.minecraft.client.renderer.OpenGlHelper;

    import net.minecraft.client.renderer.entity.RenderLiving;

    import net.minecraft.client.renderer.texture.TextureMap;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.entity.monster.EntityEnderman;

    import net.minecraft.entity.monster.EntityIronGolem;

    import net.minecraft.entity.passive.EntityMooshroom;

    import net.minecraft.util.ResourceLocation;

     

    import org.lwjgl.opengl.GL11;

    import org.lwjgl.opengl.GL12;

     

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    @SideOnly(Side.CLIENT)

    public class RenderEnt extends RenderLiving

    {

    /** Iron Golem's Model. */

        protected ModelEnt model;

     

        public RenderEnt(ModelEnt par1model, float f)

        {

            super(par1model, f);

            model = (ModelEnt)mainModel;

        }

     

        public void doRenderEnt(EntityForestWalker par1EntityEnt, double par2, double par4, double par6, float par8, float par9)

        {

        this.model.isCarrying = par1EntityEnt.getCarried() > 0;

            super.doRenderLiving(par1EntityEnt, par2, par4, par6, par8, par9);

        }

     

        /**

        * Rotates Iron Golem corpse.

        */

        protected void rotateEntCorpse(EntityForestWalker par1EntityEnt, float par2, float par3, float par4)

        {

            super.rotateCorpse(par1EntityEnt, par2, par3, par4);

     

            if ((double)par1EntityEnt.limbSwingAmount >= 0.01D)

            {

                float f3 = 13.0F;

                float f4 = par1EntityEnt.limbSwing - par1EntityEnt.limbSwingAmount * (1.0F - par4) + 6.0F;

                float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F);

                GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F);

            }

        }

     

        protected void renderEntEquippedItems(EntityForestWalker par1EntityEnt, float par2)

        {

            super.renderEquippedItems(par1EntityEnt, par2);

     

            this.bindTexture(TextureMap.locationBlocksTexture);

                GL11.glEnable(GL11.GL_CULL_FACE);

                GL11.glPushMatrix();

                GL11.glScalef(1.0F, -1.0F, 1.0F);

                GL11.glTranslatef(0.2F, 0.4F, 0.5F);

                GL11.glRotatef(42.0F, 50.0F, 1.0F, 0.0F); //Second Float changes X axis Tilt

                this.renderBlocks.renderBlockAsItem(Main.ForestWalkerSapling, 0, 1.0F);

                GL11.glTranslatef(0.1F, 0.0F, -0.6F);

                GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F);

                this.renderBlocks.renderBlockAsItem(Main.ForestWalkerSapling, 0, 1.0F);

                GL11.glPopMatrix();

                GL11.glPushMatrix();

                GL11.glScalef(1.0F, -1.0F, 1.0F);

                GL11.glTranslatef(0.0F, 0.75F, -0.2F);

                GL11.glRotatef(12.0F, 0.0F, 1.0F, 0.0F);

                //this.renderBlocks.renderBlockAsItem(TutorialMod.SilverSapling, 0, 1.0F);

                GL11.glPopMatrix();

                GL11.glDisable(GL11.GL_CULL_FACE);

        }

       

        protected void renderCarrying(EntityForestWalker par1EntityEnt, float par2)

        {

            super.renderEquippedItems(par1EntityEnt, par2);

     

            if (par1EntityEnt.getCarried() > 0)

            {

                GL11.glEnable(GL12.GL_RESCALE_NORMAL);

                GL11.glPushMatrix();

                float f1 = 0.5F;

                GL11.glTranslatef(0.0F, 0.6875F, -0.75F);

                f1 *= 1.0F;

                GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);

                GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);

                GL11.glScalef(-f1, -f1, f1);

                int i = par1EntityEnt.getBrightnessForRender(par2);

                int j = i % 65536;

                int k = i / 65536;

                OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);

                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

                this.bindTexture(TextureMap.locationBlocksTexture);

                this.renderBlocks.renderBlockAsItem(Block.blocksList[par1EntityEnt.getCarried()], par1EntityEnt.getCarryingData(), 1.0F);

                GL11.glPopMatrix();

                GL11.glDisable(GL12.GL_RESCALE_NORMAL);

            }

        }

     

        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderEnt((EntityForestWalker)par1EntityLiving, par2, par4, par6, par8, par9);

        }

     

        protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)

        {

            this.renderEntEquippedItems((EntityForestWalker)par1EntityLivingBase, par2);

            this.renderCarrying((EntityForestWalker)par1EntityLivingBase, par2);

        }

       

        protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)

        {

            this.rotateEntCorpse((EntityForestWalker)par1EntityLivingBase, par2, par3, par4);

        }

     

        public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderEnt((EntityForestWalker)par1EntityLivingBase, par2, par4, par6, par8, par9);

        }

     

        /**

        * 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.

        */

        @Override

        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)

        {

            this.doRenderEnt((EntityForestWalker)par1Entity, par2, par4, par6, par8, par9);

        }

     

    @Override

    protected ResourceLocation getEntityTexture(Entity entity) {

    return new ResourceLocation("runes:textures/armor/Ent.png");

    }

    }

     

    Model:

     

    package runes.Runes;

     

    import net.minecraft.client.model.ModelBase;

    import net.minecraft.client.model.ModelIronGolem;

    import net.minecraft.client.model.ModelRenderer;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.EntityLiving;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.entity.monster.EntityIronGolem;

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

     

    @SideOnly(Side.CLIENT)

    public class ModelEnt extends ModelBase

    {

    public boolean isCarrying;

     

    /** The head model for the iron golem. */

        public ModelRenderer ironGolemHead;

     

        /** The body model for the iron golem. */

        public ModelRenderer ironGolemBody;

     

        /** The right arm model for the iron golem. */

        public ModelRenderer ironGolemRightArm;

     

        /** The left arm model for the iron golem. */

        public ModelRenderer ironGolemLeftArm;

     

        /** The left leg model for the Iron Golem. */

        public ModelRenderer ironGolemLeftLeg;

     

        /** The right leg model for the Iron Golem. */

        public ModelRenderer ironGolemRightLeg;

     

        public ModelEnt()

        {

            this(0.0F);

        }

     

        public ModelEnt(float par1)

        {

            this(par1, -7.0F);

        }

     

        public ModelEnt(float par1, float par2)

        {

            short short1 = 128;

            short short2 = 128;

            this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.ironGolemHead.setRotationPoint(0.0F, 0.0F + par2, -2.0F);

            this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, par1);

            this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, par1);

            this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.ironGolemBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);

            this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1);

            this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F);

            this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F);

            this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1);

            this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2);

            this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F);

            this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1);

            this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);

            this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F);

            this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);

            this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);

            this.ironGolemRightLeg.mirror = true;

            this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F);

            this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);

        }

     

        /**

        * Sets the models various rotation angles then renders the model.

        */

        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)

        {

            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);

            this.ironGolemHead.render(par7);

            this.ironGolemBody.render(par7);

            this.ironGolemLeftLeg.render(par7);

            this.ironGolemRightLeg.render(par7);

            this.ironGolemRightArm.render(par7);

            this.ironGolemLeftArm.render(par7);

        }

     

        /**

        * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms

        * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how

        * "far" arms and legs can swing at most.

        */

        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)

        {

            this.ironGolemHead.rotateAngleY = par4 / (180F / (float)Math.PI);

            this.ironGolemHead.rotateAngleX = par5 / (180F / (float)Math.PI);

            this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;

            this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;

            this.ironGolemLeftLeg.rotateAngleY = 0.0F;

            this.ironGolemRightLeg.rotateAngleY = 0.0F;

        }

     

        /**

        * Used for easily adding entity-dependent animations. The second and third float params here are the same second

        * and third as in the setRotationAngles method.

        */

        public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)

        {

            EntityForestWalker entityforestwalker = (EntityForestWalker)par1EntityLivingBase;

            int i = entityforestwalker.getAttackTimer();

     

            if (i > 0)

            {

                this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);

                this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);

            }

            else

            {

                if (this.isCarrying)

                {

                this.ironGolemRightArm.rotateAngleX = -0.5F;

                    this.ironGolemLeftArm.rotateAngleX = -0.5F;

                    this.ironGolemRightArm.rotateAngleZ = 0.05F;

                    this.ironGolemLeftArm.rotateAngleZ = -0.05F;

                }

                else

                {

                    this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;

                    this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;

                }

            }

        }

     

        private float func_78172_a(float par1, float par2)

        {

            return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);

        }

    }

     

     

    Main Registry and ClientProxy are exactly the same for both except for changes in name and ID of course.

     

     

     

    Solved:

    Well my first problem was in declaring the EntityRuneGolem variable as EntityRuneGolem in the Model class, but that wasn't causing the problem. I fixed it by adding in the holdRose methods back into the Entity and Model classes. Not sure why this was causing problems before.

  5. I don't know if this will help you, but I know that minecraft passes biome based foliage color through a png file in order to get it's color. The file is just a square with varying green shades. Each biome grabs it's color from one section of this square, and so all foliage ends up with some sort of green tint. Maybe this is why you still get a green color? I was able to change birch foliage color in my own texturepack by making my own png file and making a blue copy of the green foliage file to get a nice blue tint instead. This only works with the HDPatcher to enable it, but maybe something in my description will give you a clue as to how to fix your problem? Maybe make a custom biome coloring file and call on your own custom foliage png file.

  6. How useful/important is it to register your custom items and such with OreDictionary? Is this just a useful feature for those who want it or is this something that is important enough that some people may delete a mod if it does not have it?

     

    Basically I'm wondering if it is worth the trouble of coding it into my mod files.

  7. Alright here is what I have. I wasn't able to get the code all worked out, but I believe I am close.

     

    EntityArrow:

     

    public class EntityRuneArrow extends EntityArrow implements IProjectile

    {

        private int xTile = -1;

        private int yTile = -1;

        private int zTile = -1;

        private int inTile;

        private int inData;

        private boolean inGround;

     

        /** 1 if the player can pick up the arrow */

        public int canBePickedUp;

     

        /** 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 = 4.0D;

     

        /** The amount of knockback an arrow applies when it hits a mob. */

        private int knockbackStrength;

     

        public EntityRuneArrow(World par1World)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.setSize(0.5F, 0.5F);

        }

     

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

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.setSize(0.5F, 0.5F);

            this.setPosition(par2, par4, par6);

            this.yOffset = 0.0F;

        }

     

        public EntityRuneArrow(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.shootingEntity = par2EntityLivingBase;

     

            if (par2EntityLivingBase instanceof EntityPlayer)

            {

                this.canBePickedUp = 1;

            }

     

            this.posY = par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;

            double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;

            double d1 = par3EntityLivingBase.boundingBox.minY + (double)(par3EntityLivingBase.height / 3.0F) - this.posY;

            double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;

            double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);

     

            if (d3 >= 1.0E-7D)

            {

                float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;

                float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));

                double d4 = d0 / d3;

                double d5 = d2 / d3;

                this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);

                this.yOffset = 0.0F;

                float f4 = (float)d3 * 0.2F;

                this.setThrowableHeading(d0, d1 + (double)f4, d2, par4, par5);

            }

        }

     

        public EntityRuneArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.shootingEntity = par2EntityLivingBase;

     

            if (par2EntityLivingBase instanceof EntityPlayer)

            {

                this.canBePickedUp = 1;

            }

     

            this.setSize(0.5F, 0.5F);

            this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch);

            this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);

            this.posY -= 0.10000000149011612D;

            this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);

            this.setPosition(this.posX, this.posY, this.posZ);

            this.yOffset = 0.0F;

            this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));

            this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));

            this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));

            this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);

        }

     

        @Override

        protected void entityInit()

        {

        //super.entityInit();

            this.dataWatcher.addObject(16, Byte.valueOf((byte)0));

           

            this.dataWatcher.addObject(22, "");

            }

     

        /**

        * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.

        */

        public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8)

        {

            float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);

            par1 /= (double)f2;

            par3 /= (double)f2;

            par5 /= (double)f2;

            par1 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par3 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par5 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par1 *= (double)par7;

            par3 *= (double)par7;

            par5 *= (double)par7;

            this.motionX = par1;

            this.motionY = par3;

            this.motionZ = par5;

            float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

            this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);

            this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f3) * 180.0D / Math.PI);

            this.ticksInGround = 0;

        }

     

        @SideOnly(Side.CLIENT)

     

        /**

        * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,

        * posY, posZ, yaw, pitch

        */

        public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)

        {

            this.setPosition(par1, par3, par5);

            this.setRotation(par7, par8);

        }

     

        @SideOnly(Side.CLIENT)

     

        /**

        * Sets the velocity to the args. Args: x, y, z

        */

        public void setVelocity(double par1, double par3, double par5)

        {

            this.motionX = par1;

            this.motionY = par3;

            this.motionZ = par5;

     

            if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)

            {

                float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

                this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch;

                this.prevRotationYaw = this.rotationYaw;

                this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

                this.ticksInGround = 0;

            }

        }

     

        /**

        * Called to update the entity's position/logic.

        */

        @Override

        public void onUpdate()

        {

            //super.onUpdate();

           

     

            if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)

            {

                float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

                this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);

            }

     

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

     

            if (i > 0)

            {

                Block.blocksList.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);

                AxisAlignedBB axisalignedbb = Block.blocksList.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);

     

                if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ)))

                {

                    this.inGround = true;

                }

            }

     

            if (this.arrowShake > 0)

            {

                --this.arrowShake;

            }

     

            if (this.inGround)

            {

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

                int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);

     

                if (j == this.inTile && k == this.inData)

                {

                    ++this.ticksInGround;

     

                    if (this.ticksInGround == 1200)

                    {

                        this.setDead();

                    }

                }

                else

                {

                    this.inGround = false;

                    this.motionX *= (double)(this.rand.nextFloat() * 0.2F);

                    this.motionY *= (double)(this.rand.nextFloat() * 0.2F);

                    this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);

                    this.ticksInGround = 0;

                    this.ticksInAir = 0;

                }

            }

            else

            {

                ++this.ticksInAir;

                Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);

                Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

                MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true);

                vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);

                vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

     

                if (movingobjectposition != null)

                {

                    vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);

                }

     

                Entity entity = null;

                List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));

                double d0 = 0.0D;

                int l;

                float f1;

     

                for (l = 0; l < list.size(); ++l)

                {

                    Entity entity1 = (Entity)list.get(l);

     

                    if (entity1.canBeCollidedWith() && (entity1 != this.getShooter() || this.ticksInAir >= 5))

                    {

                        f1 = 0.3F;

                        AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);

                        MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);

     

                        if (movingobjectposition1 != null)

                        {

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

     

                            if (d1 < d0 || d0 == 0.0D)

                            {

                                entity = entity1;

                                d0 = d1;

                            }

                        }

                    }

                }

     

                if (entity != null)

                {

                    movingobjectposition = new MovingObjectPosition(entity);

                }

     

                if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)

                {

                    EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;

     

                    if (entityplayer.capabilities.disableDamage || this.getShooter() instanceof EntityPlayer && !((EntityPlayer)this.getShooter()).canAttackPlayer(entityplayer))

                    {

                        movingobjectposition = null;

                    }

                }

     

                float f2;

                float f3;

     

                if (movingobjectposition != null)

                {

                    if (movingobjectposition.entityHit != null)

                    {

                        f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);

                        int i1 = MathHelper.ceiling_double_int((double)f2 * this.damage);

     

                        if (this.getIsCritical())

                        {

                            i1 += this.rand.nextInt(i1 / 2 + 2);

                        }

     

                        DamageSource damagesource = null;

     

                        if (this.getShooter() == null)

                        {

                            damagesource = EntityRuneArrow.causeRuneArrowDamage(this, this);

                        }

                        else

                        {

                            damagesource = EntityRuneArrow.causeRuneArrowDamage(this, this.getShooter());

                           

                        }

     

                        if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))

                        {

                            movingobjectposition.entityHit.setFire(5);

                        }

     

                        if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)i1))

                        {

                            if (movingobjectposition.entityHit instanceof EntityLivingBase)

                            {

                                EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;

     

                                if (!this.worldObj.isRemote)

                                {

                                    entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);

                                    entitylivingbase.addPotionEffect(new PotionEffect(Potion.wither.id, 200));

                                }

     

                                if (this.knockbackStrength > 0)

                                {

                                    f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

     

                                    if (f3 > 0.0F)

                                    {

                                        movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3);

                                    }

                                }

     

                                if (this.shootingEntity != null)

                                {

                                    EnchantmentThorns.func_92096_a(this.getShooter(), entitylivingbase, this.rand);

                                }

     

                                if (this.getShooter() != null && movingobjectposition.entityHit != this.getShooter() && movingobjectposition.entityHit instanceof EntityPlayer && this.getShooter() instanceof EntityPlayerMP)

                                {

                                    ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0));

                                }

                               

                             

                            }

                           

     

                            this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));

     

                            if (!(movingobjectposition.entityHit instanceof EntityEnderman))

                            {

                                this.setDead();

                            }

                        }

                        else

                        {

                            this.motionX *= -0.10000000149011612D;

                            this.motionY *= -0.10000000149011612D;

                            this.motionZ *= -0.10000000149011612D;

                            this.rotationYaw += 180.0F;

                            this.prevRotationYaw += 180.0F;

                            this.ticksInAir = 0;

                        }

                    }

                    else

                    {

                        this.xTile = movingobjectposition.blockX;

                        this.yTile = movingobjectposition.blockY;

                        this.zTile = movingobjectposition.blockZ;

                        this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);

                        this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);

                        this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));

                        this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));

                        this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));

                        f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);

                        this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;

                        this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;

                        this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;

                        this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));

                        this.inGround = true;

                        this.arrowShake = 7;

                        this.setIsCritical(false);

     

                        if (this.inTile != 0)

                        {

                            Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);

                        }

                    }

                }

     

                if (this.getIsCritical())

                {

                    for (l = 0; l < 4; ++l)

                    {

                        this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double)l / 4.0D, this.posY + this.motionY * (double)l / 4.0D, this.posZ + this.motionZ * (double)l / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);

                    }

                }

     

                this.posX += this.motionX;

                this.posY += this.motionY;

                this.posZ += this.motionZ;

                f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

                this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

     

                for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)

                {

                    ;

                }

     

                while (this.rotationPitch - this.prevRotationPitch >= 180.0F)

                {

                    this.prevRotationPitch += 360.0F;

                }

     

                while (this.rotationYaw - this.prevRotationYaw < -180.0F)

                {

                    this.prevRotationYaw -= 360.0F;

                }

     

                while (this.rotationYaw - this.prevRotationYaw >= 180.0F)

                {

                    this.prevRotationYaw += 360.0F;

                }

     

                this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;

                this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;

                float f4 = 0.99F;

                f1 = 0.05F;

     

                if (this.isInWater())

                {

                    for (int j1 = 0; j1 < 4; ++j1)

                    {

                        f3 = 0.25F;

                        this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);

                    }

     

                    f4 = 0.8F;

                }

     

                this.motionX *= (double)f4;

                this.motionY *= (double)f4;

                this.motionZ *= (double)f4;

                this.motionY -= (double)f1;

                this.setPosition(this.posX, this.posY, this.posZ);

                this.doBlockCollisions();

            }

        }

     

        /**

        * (abstract) Protected helper method to write subclass entity data to NBT.

        */

        public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

        {

            par1NBTTagCompound.setShort("xTile", (short)this.xTile);

            par1NBTTagCompound.setShort("yTile", (short)this.yTile);

            par1NBTTagCompound.setShort("zTile", (short)this.zTile);

            par1NBTTagCompound.setByte("inTile", (byte)this.inTile);

            par1NBTTagCompound.setByte("inData", (byte)this.inData);

            par1NBTTagCompound.setByte("shake", (byte)this.arrowShake);

            par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));

            par1NBTTagCompound.setByte("pickup", (byte)this.canBePickedUp);

            par1NBTTagCompound.setDouble("damage", this.damage);

        }

     

        /**

        * (abstract) Protected helper method to read subclass entity data from NBT.

        */

        public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

        {

            this.xTile = par1NBTTagCompound.getShort("xTile");

            this.yTile = par1NBTTagCompound.getShort("yTile");

            this.zTile = par1NBTTagCompound.getShort("zTile");

            this.inTile = par1NBTTagCompound.getByte("inTile") & 255;

            this.inData = par1NBTTagCompound.getByte("inData") & 255;

            this.arrowShake = par1NBTTagCompound.getByte("shake") & 255;

            this.inGround = par1NBTTagCompound.getByte("inGround") == 1;

     

            if (par1NBTTagCompound.hasKey("damage"))

            {

                this.damage = par1NBTTagCompound.getDouble("damage");

            }

     

            if (par1NBTTagCompound.hasKey("pickup"))

            {

                this.canBePickedUp = par1NBTTagCompound.getByte("pickup");

            }

            else if (par1NBTTagCompound.hasKey("player"))

            {

                this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0;

            }

        }

     

        /**

        * Called by a player entity when they collide with an entity

        */

        public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)

        {

            if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)

            {

                boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;

     

                if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Main.RuneWoodArrow, 1)))

                {

                    flag = false;

                }

     

                if (flag)

                {

                    this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);

                    par1EntityPlayer.onItemPickup(this, 1);

                    this.setDead();

                }

            }

        }

     

        /**

        * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to

        * prevent them from trampling crops

        */

        protected boolean canTriggerWalking()

        {

            return false;

        }

     

        @SideOnly(Side.CLIENT)

        public float getShadowSize()

        {

            return 0.0F;

        }

     

        public void setDamage(double par1)

        {

            this.damage = par1;

        }

     

        public double getDamage()

        {

            return this.damage;

        }

     

        /**

        * Sets the amount of knockback the arrow applies when it hits a mob.

        */

        public void setKnockbackStrength(int par1)

        {

            this.knockbackStrength = par1;

        }

     

        /**

        * If returns false, the item will not inflict any damage against entities.

        */

        public boolean canAttackWithItem()

        {

            return false;

        }

     

        /**

        * Whether the arrow has a stream of critical hit particles flying behind it.

        */

        public void setIsCritical(boolean par1)

        {

            byte b0 = this.dataWatcher.getWatchableObjectByte(16);

     

            if (par1)

            {

                this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));

            }

            else

            {

                this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));

            }

        }

     

        /**

        * Whether the arrow has a stream of critical hit particles flying behind it.

        */

        public boolean getIsCritical()

        {

            byte b0 = this.dataWatcher.getWatchableObjectByte(16);

            return (b0 & 1) != 0;

        }

       

        public static DamageSource causeRuneArrowDamage(EntityRuneArrow par0EntityArrow, Entity par1Entity)

        {

            return (new EntityDamageSourceIndirect("arrow", par0EntityArrow, par1Entity)).setProjectile();

        }

     

        /**

        * Returns the shooter of this arrow or null if none was available

        */

        public Entity getShooter() {

        String name = dataWatcher.getWatchableObjectString(22);

        return (name.equals("") ? shootingEntity : worldObj.getPlayerEntityByName(name));

        }

       

        /**

        * Used to update the datawatcher shooting entity object

        */

        public EntityRuneArrow setShooter(EntityPlayer player) {

        dataWatcher.updateObject(new Byte((byte)0), player != null ? player.username : "");

        return this;

        }

    }

     

     

    CustomBow that spawns arrow:

     

    public class RuneBow extends Item{

    private Icon[] Texture = new Icon[4];

     

    public RuneBow(int par1)

        {

            super(par1);

            this.maxStackSize = 1;

            this.setMaxDamage(800);

            this.setFull3D();

            this.setCreativeTab(Main.tabRunesMod);

        }

    @Override

    public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)

        {

            int j = this.getMaxItemUseDuration(par1ItemStack) - par4;

            ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);

            MinecraftForge.EVENT_BUS.post(event);

     

            if (event.isCanceled())

            {

                return;

            }

     

            j = event.charge;

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

     

            if (flag || par3EntityPlayer.inventory.hasItem(Main.RuneWoodArrow.itemID));

            {

                float f = (float)j / 20.0F;

                f = (f * f + f * 2.0F) / 3.0F;

     

                if ((double)f < 0.1D)

                {

                    return;

                }

     

                if (f > 1.0F)

                {

                    f = 1.0F;

                }

     

                EntityRuneArrow entityarrow = new EntityRuneArrow(par2World, par3EntityPlayer, f * 2.0F).setShooter(par3EntityPlayer);

                //EntityRuneArrow entityarrow = new EntityRuneArrow(par2World, par3EntityPlayer, f * 2.0F);

     

                if (f == 1.0F)

                {

                    entityarrow.setIsCritical(true);

                }

     

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

     

                if (k > 0)

                {

                    entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);

                }

     

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

     

                if (l > 0)

                {

                    entityarrow.setKnockbackStrength(l);

                }

     

                if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)

                {

                    entityarrow.setFire(100);

                }

     

                par1ItemStack.damageItem(1, par3EntityPlayer);

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

     

                if (flag)

                {

                    entityarrow.canBePickedUp = 2;

                }

                else

                {

                    par3EntityPlayer.inventory.consumeInventoryItem(Main.RuneWoodArrow.itemID);

                }

     

                if (!par2World.isRemote)

                {

                    par2World.spawnEntityInWorld(entityarrow);

                   

                }

            }

        }

     

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

        {

            return par1ItemStack;

        }

     

        /**

        * How long it takes to use or consume an item

        */

        public int getMaxItemUseDuration(ItemStack par1ItemStack)

        {

            return 72000;

        }

     

        /**

        * returns the action that specifies what animation to play when the items is being used

        */

        public EnumAction getItemUseAction(ItemStack par1ItemStack)

        {

            return EnumAction.bow;

        }

     

        /**

        * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer

        */

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

        {

            ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);

            MinecraftForge.EVENT_BUS.post(event);

     

            if (event.isCanceled())

            {

                return event.result;

            }

     

            if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Main.RuneWoodArrow.itemID))

            {

                par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

            }

     

            return par1ItemStack;

        }

     

        /**

        * Return the enchantability factor of the item, most of the time is based on material.

        */

        public int getItemEnchantability()

        {

            return 1;

        }

     

    @SideOnly(Side.CLIENT)

     

    public void registerIcons(IconRegister iconRegister)

     

    {

    itemIcon = iconRegister.registerIcon(Main.modid + ":" + (this.getUnlocalizedName().substring(5) + "_0"));

            for (int N = 0; N < 4; N++)

                      {

          this.Texture[N] = iconRegister.registerIcon(Main.modid + ":" + (this.getUnlocalizedName().substring(5) + "_" + N));

                      }

    }

    public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)

    {

                            if(player.getItemInUse() == null) return this.itemIcon;

                            int Pulling = stack.getMaxItemUseDuration() - useRemaining;

                            if (Pulling >= 18)

                            {

                                            return Texture[3];

                            }

                            else if (Pulling > 13)

                            {

                                            return Texture[2];

                            }

                            else if (Pulling > 0)

                            {

                                            return Texture[1];

                            }

                            return Texture[0];

                            }

    }

     

  8. I think I will understand it better if I were to see it in action.  All I can understand from the Tutorial is that I need a string type datawatcher, the string ending up being the players name? Could you show me what the code would look like in the EntityInit method?

     

  9. alright so I need to add my own datawatcher to the EntityInit method, and it should look something like this I'm assuming?

    this.dataWatcher.addObject(22, "SHOOTER_DATAWATCHER_INDEX"); 

     

    I've switched out the shootingEntity references, and I am assuming I'm falling short on the whole Datawatcher thing? I haven't tried adding a DataWatcher before.

     

     

  10. I've seen a couple posts about this but so far I haven't seen an actual working fix for it, unless I am doing something wrong. Whenever I shoot my custom arrow, it just hits me. From what I have seen in other posts, it's because the arrow is being spawned right where the player is standing therefore hits the player? Problem is I do not know how to fix this. Any help? (I am extending from IThrowableEntity as a suggested fix, but still no difference.)

     

    Entity:

     

    public class EntityRuneArrow extends EntityArrow implements IThrowableEntity

    {

        private int xTile = -1;

        private int yTile = -1;

        private int zTile = -1;

        private int inTile;

        private int inData;

        private boolean inGround;

     

        /** 1 if the player can pick up the arrow */

        public int canBePickedUp;

     

        /** 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 = 4.0D;

     

        /** The amount of knockback an arrow applies when it hits a mob. */

        private int knockbackStrength;

     

        public EntityRuneArrow(World par1World)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.setSize(0.5F, 0.5F);

        }

     

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

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.setSize(0.5F, 0.5F);

            this.setPosition(par2, par4, par6);

            this.yOffset = 0.0F;

        }

     

        public EntityRuneArrow(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.shootingEntity = par2EntityLivingBase;

     

            if (par2EntityLivingBase instanceof EntityPlayer)

            {

                this.canBePickedUp = 1;

            }

     

            this.posY = par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;

            double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;

            double d1 = par3EntityLivingBase.boundingBox.minY + (double)(par3EntityLivingBase.height / 3.0F) - this.posY;

            double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;

            double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);

     

            if (d3 >= 1.0E-7D)

            {

                float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;

                float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));

                double d4 = d0 / d3;

                double d5 = d2 / d3;

                this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);

                this.yOffset = 0.0F;

                float f4 = (float)d3 * 0.2F;

                this.setThrowableHeading(d0, d1 + (double)f4, d2, par4, par5);

            }

        }

     

        public EntityRuneArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3)

        {

            super(par1World);

            this.renderDistanceWeight = 10.0D;

            this.shootingEntity = par2EntityLivingBase;

     

            if (par2EntityLivingBase instanceof EntityPlayer)

            {

                this.canBePickedUp = 1;

            }

     

            this.setSize(0.5F, 0.5F);

            this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch);

            this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);

            this.posY -= 0.10000000149011612D;

            this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);

            this.setPosition(this.posX, this.posY, this.posZ);

            this.yOffset = 0.0F;

            this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));

            this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));

            this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));

            this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);

        }

     

        protected void entityInit()

        {

            this.dataWatcher.addObject(16, Byte.valueOf((byte)0));

        }

     

        /**

        * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.

        */

        public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8)

        {

            float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);

            par1 /= (double)f2;

            par3 /= (double)f2;

            par5 /= (double)f2;

            par1 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par3 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par5 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8;

            par1 *= (double)par7;

            par3 *= (double)par7;

            par5 *= (double)par7;

            this.motionX = par1;

            this.motionY = par3;

            this.motionZ = par5;

            float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

            this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);

            this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f3) * 180.0D / Math.PI);

            this.ticksInGround = 0;

        }

     

        @SideOnly(Side.CLIENT)

     

        /**

        * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,

        * posY, posZ, yaw, pitch

        */

        public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)

        {

            this.setPosition(par1, par3, par5);

            this.setRotation(par7, par8);

        }

     

        @SideOnly(Side.CLIENT)

     

        /**

        * Sets the velocity to the args. Args: x, y, z

        */

        public void setVelocity(double par1, double par3, double par5)

        {

            this.motionX = par1;

            this.motionY = par3;

            this.motionZ = par5;

     

            if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)

            {

                float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

                this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch;

                this.prevRotationYaw = this.rotationYaw;

                this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

                this.ticksInGround = 0;

            }

        }

     

        /**

        * Called to update the entity's position/logic.

        */

        public void onUpdate()

        {

            super.onUpdate();

     

            if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)

            {

                float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

                this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

                this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);

            }

     

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

     

            if (i > 0)

            {

                Block.blocksList.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);

                AxisAlignedBB axisalignedbb = Block.blocksList.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);

     

                if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ)))

                {

                    this.inGround = true;

                }

            }

     

            if (this.arrowShake > 0)

            {

                --this.arrowShake;

            }

     

            if (this.inGround)

            {

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

                int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);

     

                if (j == this.inTile && k == this.inData)

                {

                    ++this.ticksInGround;

     

                    if (this.ticksInGround == 1200)

                    {

                        this.setDead();

                    }

                }

                else

                {

                    this.inGround = false;

                    this.motionX *= (double)(this.rand.nextFloat() * 0.2F);

                    this.motionY *= (double)(this.rand.nextFloat() * 0.2F);

                    this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);

                    this.ticksInGround = 0;

                    this.ticksInAir = 0;

                }

            }

            else

            {

                ++this.ticksInAir;

                Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);

                Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

                MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true);

                vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);

                vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

     

                if (movingobjectposition != null)

                {

                    vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);

                }

     

                Entity entity = null;

                List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));

                double d0 = 0.0D;

                int l;

                float f1;

     

                for (l = 0; l < list.size(); ++l)

                {

                    Entity entity1 = (Entity)list.get(l);

     

                    if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))

                    {

                        f1 = 0.3F;

                        AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);

                        MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);

     

                        if (movingobjectposition1 != null)

                        {

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

     

                            if (d1 < d0 || d0 == 0.0D)

                            {

                                entity = entity1;

                                d0 = d1;

                            }

                        }

                    }

                }

     

                if (entity != null)

                {

                    movingobjectposition = new MovingObjectPosition(entity);

                }

     

                if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)

                {

                    EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;

     

                    if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))

                    {

                        movingobjectposition = null;

                    }

                }

     

                float f2;

                float f3;

     

                if (movingobjectposition != null)

                {

                    if (movingobjectposition.entityHit != null)

                    {

                        f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);

                        int i1 = MathHelper.ceiling_double_int((double)f2 * this.damage);

     

                        if (this.getIsCritical())

                        {

                            i1 += this.rand.nextInt(i1 / 2 + 2);

                        }

     

                        DamageSource damagesource = null;

     

                        if (this.shootingEntity == null)

                        {

                            damagesource = EntityRuneArrow.causeRuneArrowDamage(this, this);

                        }

                        else

                        {

                            damagesource = EntityRuneArrow.causeRuneArrowDamage(this, this.shootingEntity);

                           

                        }

     

                        if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))

                        {

                            movingobjectposition.entityHit.setFire(5);

                        }

     

                        if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)i1))

                        {

                            if (movingobjectposition.entityHit instanceof EntityLivingBase)

                            {

                                EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;

     

                                if (!this.worldObj.isRemote)

                                {

                                    entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);

                                    entitylivingbase.addPotionEffect(new PotionEffect(Potion.wither.id, 200));

                                }

     

                                if (this.knockbackStrength > 0)

                                {

                                    f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

     

                                    if (f3 > 0.0F)

                                    {

                                        movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f3);

                                    }

                                }

     

                                if (this.shootingEntity != null)

                                {

                                    EnchantmentThorns.func_92096_a(this.shootingEntity, entitylivingbase, this.rand);

                                }

     

                                if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)

                                {

                                    ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0));

                                }

                               

                             

                            }

                           

     

                            this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));

     

                            if (!(movingobjectposition.entityHit instanceof EntityEnderman))

                            {

                                this.setDead();

                            }

                        }

                        else

                        {

                            this.motionX *= -0.10000000149011612D;

                            this.motionY *= -0.10000000149011612D;

                            this.motionZ *= -0.10000000149011612D;

                            this.rotationYaw += 180.0F;

                            this.prevRotationYaw += 180.0F;

                            this.ticksInAir = 0;

                        }

                    }

                    else

                    {

                        this.xTile = movingobjectposition.blockX;

                        this.yTile = movingobjectposition.blockY;

                        this.zTile = movingobjectposition.blockZ;

                        this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);

                        this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);

                        this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));

                        this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));

                        this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));

                        f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);

                        this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;

                        this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;

                        this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;

                        this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));

                        this.inGround = true;

                        this.arrowShake = 7;

                        this.setIsCritical(false);

     

                        if (this.inTile != 0)

                        {

                            Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);

                        }

                    }

                }

     

                if (this.getIsCritical())

                {

                    for (l = 0; l < 4; ++l)

                    {

                        this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double)l / 4.0D, this.posY + this.motionY * (double)l / 4.0D, this.posZ + this.motionZ * (double)l / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);

                    }

                }

     

                this.posX += this.motionX;

                this.posY += this.motionY;

                this.posZ += this.motionZ;

                f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);

                this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

     

                for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)

                {

                    ;

                }

     

                while (this.rotationPitch - this.prevRotationPitch >= 180.0F)

                {

                    this.prevRotationPitch += 360.0F;

                }

     

                while (this.rotationYaw - this.prevRotationYaw < -180.0F)

                {

                    this.prevRotationYaw -= 360.0F;

                }

     

                while (this.rotationYaw - this.prevRotationYaw >= 180.0F)

                {

                    this.prevRotationYaw += 360.0F;

                }

     

                this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;

                this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;

                float f4 = 0.99F;

                f1 = 0.05F;

     

                if (this.isInWater())

                {

                    for (int j1 = 0; j1 < 4; ++j1)

                    {

                        f3 = 0.25F;

                        this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);

                    }

     

                    f4 = 0.8F;

                }

     

                this.motionX *= (double)f4;

                this.motionY *= (double)f4;

                this.motionZ *= (double)f4;

                this.motionY -= (double)f1;

                this.setPosition(this.posX, this.posY, this.posZ);

                this.doBlockCollisions();

            }

        }

     

        /**

        * (abstract) Protected helper method to write subclass entity data to NBT.

        */

        public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

        {

            par1NBTTagCompound.setShort("xTile", (short)this.xTile);

            par1NBTTagCompound.setShort("yTile", (short)this.yTile);

            par1NBTTagCompound.setShort("zTile", (short)this.zTile);

            par1NBTTagCompound.setByte("inTile", (byte)this.inTile);

            par1NBTTagCompound.setByte("inData", (byte)this.inData);

            par1NBTTagCompound.setByte("shake", (byte)this.arrowShake);

            par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));

            par1NBTTagCompound.setByte("pickup", (byte)this.canBePickedUp);

            par1NBTTagCompound.setDouble("damage", this.damage);

        }

     

        /**

        * (abstract) Protected helper method to read subclass entity data from NBT.

        */

        public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

        {

            this.xTile = par1NBTTagCompound.getShort("xTile");

            this.yTile = par1NBTTagCompound.getShort("yTile");

            this.zTile = par1NBTTagCompound.getShort("zTile");

            this.inTile = par1NBTTagCompound.getByte("inTile") & 255;

            this.inData = par1NBTTagCompound.getByte("inData") & 255;

            this.arrowShake = par1NBTTagCompound.getByte("shake") & 255;

            this.inGround = par1NBTTagCompound.getByte("inGround") == 1;

     

            if (par1NBTTagCompound.hasKey("damage"))

            {

                this.damage = par1NBTTagCompound.getDouble("damage");

            }

     

            if (par1NBTTagCompound.hasKey("pickup"))

            {

                this.canBePickedUp = par1NBTTagCompound.getByte("pickup");

            }

            else if (par1NBTTagCompound.hasKey("player"))

            {

                this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0;

            }

        }

     

        /**

        * Called by a player entity when they collide with an entity

        */

        public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)

        {

            if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)

            {

                boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;

     

                if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1)))

                {

                    flag = false;

                }

     

                if (flag)

                {

                    this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);

                    par1EntityPlayer.onItemPickup(this, 1);

                    this.setDead();

                }

            }

        }

     

        /**

        * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to

        * prevent them from trampling crops

        */

        protected boolean canTriggerWalking()

        {

            return false;

        }

     

        @SideOnly(Side.CLIENT)

        public float getShadowSize()

        {

            return 0.0F;

        }

     

        public void setDamage(double par1)

        {

            this.damage = par1;

        }

     

        public double getDamage()

        {

            return this.damage;

        }

     

        /**

        * Sets the amount of knockback the arrow applies when it hits a mob.

        */

        public void setKnockbackStrength(int par1)

        {

            this.knockbackStrength = par1;

        }

     

        /**

        * If returns false, the item will not inflict any damage against entities.

        */

        public boolean canAttackWithItem()

        {

            return false;

        }

     

        /**

        * Whether the arrow has a stream of critical hit particles flying behind it.

        */

        public void setIsCritical(boolean par1)

        {

            byte b0 = this.dataWatcher.getWatchableObjectByte(16);

     

            if (par1)

            {

                this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));

            }

            else

            {

                this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));

            }

        }

     

        /**

        * Whether the arrow has a stream of critical hit particles flying behind it.

        */

        public boolean getIsCritical()

        {

            byte b0 = this.dataWatcher.getWatchableObjectByte(16);

            return (b0 & 1) != 0;

        }

       

        public static DamageSource causeRuneArrowDamage(EntityRuneArrow par0EntityArrow, Entity par1Entity)

        {

            return (new EntityDamageSourceIndirect("arrow", par0EntityArrow, par1Entity)).setProjectile();

        }

     

        @Override

        public Entity getThrower() {

        return shootingEntity;

        }

     

        @Override

        public void setThrower(Entity entity) {

        this.shootingEntity = entity;

        }

     

  11. I'm having an issue where my custom arrow appears stuck in the air a block from where it actually hit? So it looks like |  <--  instead of |<--. Any help in troubleshooting this?

     

    Render

    @SideOnly(Side.CLIENT)
    public class RenderRuneArrow extends Render
    {
        private static final ResourceLocation arrowTextures = new ResourceLocation("runes:textures/entity/RuneArrowRender.png");
    
        public void renderArrow(EntityRuneArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
        {
            this.bindEntityTexture(par1EntityArrow);
            GL11.glPushMatrix();
            GL11.glTranslatef((float)par2, (float)par4, (float)par6);
            GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
            Tessellator tessellator = Tessellator.instance;
            byte b0 = 0;
            float f2 = 0.0F;
            float f3 = 0.5F;
            float f4 = (float)(0 + b0 * 10) / 32.0F;
            float f5 = (float)(5 + b0 * 10) / 32.0F;
            float f6 = 0.0F;
            float f7 = 0.15625F;
            float f8 = (float)(5 + b0 * 10) / 32.0F;
            float f9 = (float)(10 + b0 * 10) / 32.0F;
            float f10 = 0.05625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            float f11 = (float)par1EntityArrow.arrowShake - par9;
    
            if (f11 > 0.0F)
            {
                float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
                GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
            }
    
            GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(f10, f10, f10);
            GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
            GL11.glNormal3f(f10, 0.0F, 0.0F);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
            tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
            tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
            tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
            tessellator.draw();
            GL11.glNormal3f(-f10, 0.0F, 0.0F);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
            tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
            tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
            tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
            tessellator.draw();
    
            for (int i = 0; i < 4; ++i)
            {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
                GL11.glNormal3f(0.0F, 0.0F, f10);
                tessellator.startDrawingQuads();
                tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
                tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
                tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
                tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
                tessellator.draw();
            }
    
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            GL11.glPopMatrix();
        }
    
        protected ResourceLocation getArrowTextures(EntityRuneArrow par1EntityArrow)
        {
            return arrowTextures;
        }
    
        /**
         * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
         */
        protected ResourceLocation getEntityTexture(Entity par1Entity)
        {
            return this.getArrowTextures((EntityRuneArrow)par1Entity);
        }
    
        /**
         * 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)
        {
            this.renderArrow((EntityRuneArrow)par1Entity, par2, par4, par6, par8, par9);
        }
    }

  12. Alright so this is what I have so far, although I know it's probably wrong and I am missing the Pos X, Y, Z.

     

    @Override
    public boolean getCanSpawnHere()
        {
    	float f = 8.0F;
            List list;
            int i;
            
    
                list = this.worldObj.getEntitiesWithinAABB(EntityForestWalker.class, this.boundingBox.expand((double)f, (double)f, (double)f));
    
                if (list.size() > 0){
                	return false;
                }
                else
                {
                	return true;
                }
    
        } 

     

    I'm assuming it is something close to this?

×
×
  • Create New...

Important Information

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