Package logisticspipes.proxy.buildcraft

Source Code of logisticspipes.proxy.buildcraft.BCEventHandler

package logisticspipes.proxy.buildcraft;

import logisticspipes.routing.ItemRoutingInformation;
import logisticspipes.transport.LPTravelingItem.LPTravelingItemServer;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.pipes.events.PipeEvent;
import buildcraft.transport.pipes.events.PipeEventItem.DropItem;

public class BCEventHandler {
  /*
   * Called trough ASM from Pipe.handlePipeEvent();
   */
  public static void handle(PipeEvent event, Pipe<?> pipe) {
    if(event instanceof DropItem) {
      if(pipe != null) {
        if(pipe.transport instanceof PipeTransportItems) {
          ItemRoutingInformation info = null;
          if(((DropItem)event).item instanceof LPRoutedBCTravelingItem) {
            info = ((LPRoutedBCTravelingItem)((DropItem)event).item).getRoutingInformation();
          } else {
            info = LPRoutedBCTravelingItem.restoreFromExtraNBTData(((DropItem)event).item);
          }
          if(info != null) {
            LPTravelingItemServer lpItem = new LPTravelingItemServer(info);
            lpItem.setContainer(pipe.container);
            lpItem.itemWasLost();
          }
        }
      }
    }
  }
}
TOP

Related Classes of logisticspipes.proxy.buildcraft.BCEventHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.