コード例 #1
0
 @Override
 public void syncEntity(Entity e, boolean spawn, boolean destroy, boolean update) {
   EntityProtocol ep = e.getNetwork().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID);
   if (ep != null) {
     List<Message> messages = new ArrayList<Message>(3);
     // Sync using vanilla protocol
     if (destroy) {
       messages.addAll(ep.getDestroyMessages(e));
     }
     if (spawn) {
       messages.addAll(ep.getSpawnMessages(e));
     }
     if (update) {
       messages.addAll(ep.getUpdateMessages(e));
     }
     for (Message message : messages) {
       this.session.send(false, message);
     }
   }
 }
コード例 #2
0
 @Override
 public void syncEntity(
     Entity e, Transform liveTransform, boolean spawn, boolean destroy, boolean update) {
   super.syncEntity(e, liveTransform, spawn, destroy, update);
   EntityProtocol ep = e.getNetwork().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID);
   if (ep != null) {
     List<Message> messages = new ArrayList<Message>();
     // Sync using vanilla protocol
     if (destroy) {
       messages.addAll(ep.getDestroyMessages(e));
     }
     if (spawn) {
       messages.addAll(ep.getSpawnMessages(e, getRepositionManager()));
     }
     if (update) {
       boolean force = shouldForce(e.getId());
       messages.addAll(ep.getUpdateMessages(e, liveTransform, getRepositionManager(), force));
     }
     for (Message message : messages) {
       this.session.send(false, message);
     }
   }
 }