示例#1
0
 private Packet getSpawnPacket()
 {
     if (trackedEntity is EntityItem)
     {
         var entityitem = (EntityItem) trackedEntity;
         var packet21pickupspawn = new Packet21PickupSpawn(entityitem);
         entityitem.posX = packet21pickupspawn.xPosition/32D;
         entityitem.posY = packet21pickupspawn.yPosition/32D;
         entityitem.posZ = packet21pickupspawn.zPosition/32D;
         return packet21pickupspawn;
     }
     if (trackedEntity is EntityPlayerMP)
     {
         return new Packet20NamedEntitySpawn((EntityPlayer) trackedEntity);
     }
     if (trackedEntity is EntityMinecart)
     {
         var entityminecart = (EntityMinecart) trackedEntity;
         if (entityminecart.minecartType == 0)
         {
             return new Packet23VehicleSpawn(trackedEntity, 10);
         }
         if (entityminecart.minecartType == 1)
         {
             return new Packet23VehicleSpawn(trackedEntity, 11);
         }
         if (entityminecart.minecartType == 2)
         {
             return new Packet23VehicleSpawn(trackedEntity, 12);
         }
     }
     if (trackedEntity is EntityBoat)
     {
         return new Packet23VehicleSpawn(trackedEntity, 1);
     }
     if (trackedEntity is IAnimals)
     {
         return new Packet24MobSpawn((EntityLiving) trackedEntity);
     }
     if (trackedEntity is EntityFish)
     {
         return new Packet23VehicleSpawn(trackedEntity, 90);
     }
     if (trackedEntity is EntityArrow)
     {
         return new Packet23VehicleSpawn(trackedEntity, 60);
     }
     if (trackedEntity is EntitySnowball)
     {
         return new Packet23VehicleSpawn(trackedEntity, 61);
     }
     if (trackedEntity is EntityEgg)
     {
         return new Packet23VehicleSpawn(trackedEntity, 62);
     }
     if (trackedEntity is EntityTNTPrimed)
     {
         return new Packet23VehicleSpawn(trackedEntity, 50);
     }
     if (trackedEntity is EntityFallingSand)
     {
         var entityfallingsand = (EntityFallingSand) trackedEntity;
         if (entityfallingsand.blockID == Block.sand.blockID)
         {
             return new Packet23VehicleSpawn(trackedEntity, 70);
         }
         if (entityfallingsand.blockID == Block.gravel.blockID)
         {
             return new Packet23VehicleSpawn(trackedEntity, 71);
         }
     }
     if (trackedEntity is EntityPainting)
     {
         return new Packet25((EntityPainting) trackedEntity);
     }
     else
     {
         throw new IllegalArgumentException(
             (new StringBuilder()).append("Don't know how to add ").append(trackedEntity.GetType()).append("!").
                 toString());
     }
 }
示例#2
0
 private Packet getSpawnPacket()
 {
     if (trackedEntity is EntityItem)
     {
         var entityitem          = (EntityItem)trackedEntity;
         var packet21pickupspawn = new Packet21PickupSpawn(entityitem);
         entityitem.posX = packet21pickupspawn.xPosition / 32D;
         entityitem.posY = packet21pickupspawn.yPosition / 32D;
         entityitem.posZ = packet21pickupspawn.zPosition / 32D;
         return(packet21pickupspawn);
     }
     if (trackedEntity is EntityPlayerMP)
     {
         return(new Packet20NamedEntitySpawn((EntityPlayer)trackedEntity));
     }
     if (trackedEntity is EntityMinecart)
     {
         var entityminecart = (EntityMinecart)trackedEntity;
         if (entityminecart.minecartType == 0)
         {
             return(new Packet23VehicleSpawn(trackedEntity, 10));
         }
         if (entityminecart.minecartType == 1)
         {
             return(new Packet23VehicleSpawn(trackedEntity, 11));
         }
         if (entityminecart.minecartType == 2)
         {
             return(new Packet23VehicleSpawn(trackedEntity, 12));
         }
     }
     if (trackedEntity is EntityBoat)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 1));
     }
     if (trackedEntity is IAnimals)
     {
         return(new Packet24MobSpawn((EntityLiving)trackedEntity));
     }
     if (trackedEntity is EntityFish)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 90));
     }
     if (trackedEntity is EntityArrow)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 60));
     }
     if (trackedEntity is EntitySnowball)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 61));
     }
     if (trackedEntity is EntityEgg)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 62));
     }
     if (trackedEntity is EntityTNTPrimed)
     {
         return(new Packet23VehicleSpawn(trackedEntity, 50));
     }
     if (trackedEntity is EntityFallingSand)
     {
         var entityfallingsand = (EntityFallingSand)trackedEntity;
         if (entityfallingsand.blockID == Block.sand.blockID)
         {
             return(new Packet23VehicleSpawn(trackedEntity, 70));
         }
         if (entityfallingsand.blockID == Block.gravel.blockID)
         {
             return(new Packet23VehicleSpawn(trackedEntity, 71));
         }
     }
     if (trackedEntity is EntityPainting)
     {
         return(new Packet25((EntityPainting)trackedEntity));
     }
     else
     {
         throw new IllegalArgumentException(
                   (new StringBuilder()).append("Don't know how to add ").append(trackedEntity.GetType()).append("!").
                   toString());
     }
 }