示例#1
0
 /**
  * Sets the entity skin for the target entity to the url. The Skin Type is used when an entity has
  * more than one skin type.
  *
  * @param target to set the skin on
  * @param url of the skin
  * @param type of skin to set
  */
 public void setEntitySkin(LivingEntity target, String url, EntitySkinType type) {
   SpoutManager.getPlayerChunkMap().getGlobalInfo().setEntitySkin(target, url, type);
   ArrayList<LivingEntity> entities = new ArrayList<LivingEntity>(1);
   entities.add(target);
   for (SpoutPlayer player : getOnlinePlayers()) {
     player.updateEntitySkins(entities);
   }
 }
示例#2
0
 public void setTitle(LivingEntity entity, String title) {
   if (entity instanceof SpoutPlayer) {
     ((SpoutPlayer) entity).setTitle(title);
   }
   titles.put(entity.getEntityId(), title);
   ArrayList<LivingEntity> entities = new ArrayList<LivingEntity>(1);
   entities.add(entity);
   for (SpoutPlayer player : getOnlinePlayers()) {
     player.updateEntitySkins(entities);
   }
 }
 @Override
 public void run(int playerId) {
   SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
   if (player != null) {
     ByteBuffer rawData = ByteBuffer.allocate(data.length);
     rawData.put(data);
     ArrayList<LivingEntity> entities = new ArrayList<LivingEntity>(data.length / 4 + 1);
     for (int i = 0; i < data.length / 4; i++) {
       int index = i * 4;
       int id = rawData.getInt(index);
       Entity entity = SpoutManager.getEntityFromId(id);
       if (entity != null && entity instanceof LivingEntity) {
         entities.add((LivingEntity) entity);
       }
     }
     if (entities.size() > 0) {
       player.sendPacket(new PacketEntityInformation(entities));
       player.updateEntitySkins(entities);
     }
   }
 }