Ejemplo n.º 1
0
 protected internal override void AttackEntity(net.minecraft.src.Entity entity, float
                                               f)
 {
     if (f < 10F)
     {
         double d  = entity.posX - posX;
         double d1 = entity.posZ - posZ;
         if (attackTime == 0)
         {
             net.minecraft.src.EntityArrow entityarrow = new net.minecraft.src.EntityArrow(worldObj
                                                                                           , this);
             entityarrow.posY += 1.3999999761581421D;
             double d2 = (entity.posY + (double)entity.GetEyeHeight()) - 0.20000000298023224D
                         - entityarrow.posY;
             float f1 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d1 * d1) * 0.2F;
             worldObj.PlaySoundAtEntity(this, "random.bow", 1.0F, 1.0F / (rand.NextFloat() * 0.4F
                                                                          + 0.8F));
             worldObj.AddEntity(entityarrow);
             entityarrow.SetArrowHeading(d, d2 + (double)f1, d1, 0.6F, 12F);
             attackTime = 30;
         }
         rotationYaw = (float)((System.Math.Atan2(d1, d) * 180D) / 3.1415927410125732D) -
                       90F;
         hasAttacked = true;
     }
 }
Ejemplo n.º 2
0
 public override bool AttackEntityFrom(net.minecraft.src.Entity entity, int i)
 {
     if (ticksOfInvuln > 0)
     {
         return(false);
     }
     if (!mcServer.pvpOn)
     {
         if (entity is net.minecraft.src.EntityPlayer)
         {
             return(false);
         }
         if (entity is net.minecraft.src.EntityArrow)
         {
             net.minecraft.src.EntityArrow entityarrow = (net.minecraft.src.EntityArrow)entity;
             if (entityarrow.owner is net.minecraft.src.EntityPlayer)
             {
                 return(false);
             }
         }
     }
     return(base.AttackEntityFrom(entity, i));
 }
Ejemplo n.º 3
0
        public void DispenseItem(net.minecraft.src.World world, int i, int j, int k, SharpBukkitLive.SharpBukkit.SharpRandom random)
        {
            //TODO: Implement dispenser fixes
            return;

            int l  = world.GetBlockMetadata(i, j, k);
            int i1 = 0;
            int j1 = 0;

            if (l == 3)
            {
                j1 = 1;
            }
            else if (l == 2)
            {
                j1 = -1;
            }
            else if (l == 5)
            {
                i1 = 1;
            }
            else
            {
                i1 = -1;
            }

            net.minecraft.src.TileEntityDispenser tileentitydispenser = (net.minecraft.src.TileEntityDispenser)world.GetBlockTileEntity(i, j, k);
            net.minecraft.src.ItemStack           itemstack           = tileentitydispenser.GetRandomStackFromInventory();
            double d  = (double)i + (double)i1 * 0.59999999999999998D + 0.5D;
            double d1 = (double)j + 0.5D;
            double d2 = (double)k + (double)j1 * 0.59999999999999998D + 0.5D;

            if (itemstack == null)
            {
                world.SendSoundEffectToAllPlayersWithin64(1001, i, j, k, 0);
            }
            else
            {
                if (itemstack.itemID == net.minecraft.src.Item.ARROW.ID)
                {
                    net.minecraft.src.EntityArrow entityarrow = new net.minecraft.src.EntityArrow(world, d, d1, d2);
                    entityarrow.SetArrowHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F);
                    entityarrow.field_28012_a = true;
                    world.AddEntity(entityarrow);
                    world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0);
                }
                else if (itemstack.itemID == net.minecraft.src.Item.EGG.ID)
                {
                    net.minecraft.src.EntityEgg entityegg = new net.minecraft.src.EntityEgg(world, d, d1, d2);
                    entityegg.SetEggHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F);
                    world.AddEntity(entityegg);
                    world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0);
                }
                else if (itemstack.itemID == net.minecraft.src.Item.SNOW_BALL.ID)
                {
                    net.minecraft.src.EntitySnowball entitysnowball = new net.minecraft.src.EntitySnowball(world, d, d1, d2);
                    entitysnowball.SetSnowballHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F);
                    world.AddEntity(entitysnowball);
                    world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0);
                }
                else
                {
                    net.minecraft.src.EntityItem entityitem = new net.minecraft.src.EntityItem(world, d, d1 - 0.29999999999999999D, d2, itemstack);
                    double d3 = random.NextDouble() * 0.10000000000000001D + 0.20000000000000001D;
                    entityitem.motionX  = (double)i1 * d3;
                    entityitem.motionY  = 0.20000000298023224D;
                    entityitem.motionZ  = (double)j1 * d3;
                    entityitem.motionX += random.NextGaussian() * 0.0074999998323619366D * 6D;
                    entityitem.motionY += random.NextGaussian() * 0.0074999998323619366D * 6D;
                    entityitem.motionZ += random.NextGaussian() * 0.0074999998323619366D * 6D;
                    world.AddEntity(entityitem);
                    world.SendSoundEffectToAllPlayersWithin64(1000, i, j, k, 0);
                }

                world.SendSoundEffectToAllPlayersWithin64(2000, i, j, k, i1 + 1 + (j1 + 1) * 3);
            }
        }