Ejemplo n.º 1
0
 public RobotUpgradeCamera(TileEntity entity) {
   this.entity = entity;
   this.robot = (Robot) entity;
   this.node =
       Network.newNode(this, Visibility.Network)
           .withConnector()
           .withComponent("camera", Visibility.Neighbors)
           .create();
 }
 @Override
 public void updateEntity() {
   super.updateEntity();
   // On the first update, try to add our node to nearby networks. We do
   // this in the update logic, not in validate() because we need to access
   // neighboring tile entities, which isn't possible in validate().
   // We could alternatively check node != null && node.network() == null,
   // but this has somewhat better performance, and makes it clearer.
   if (!addedToNetwork) {
     addedToNetwork = true;
     // Note that joinOrCreateNetwork will try to connect each of our
     // sided nodes to their respective neighbor (sided) node.
     Network.joinOrCreateNetwork(this);
   }
 }