endReached should control further processing

This commit is contained in:
CovertJaguar 2013-07-31 23:22:01 -07:00
parent 617d06c3b0
commit 3985e58970
4 changed files with 16 additions and 5 deletions

View file

@ -8,6 +8,14 @@ public interface IItemTravelingHook {
public void centerReached(PipeTransportItems transport, TravelingItem item);
public void endReached(PipeTransportItems transport, TravelingItem item, TileEntity tile);
/**
* Overrides default handling of what occurs when an Item reaches the end of the time pipe.
*
* @param transport
* @param item
* @param tile
* @return false if the transport code should handle the item normally, true if its been handled
*/
public boolean endReached(PipeTransportItems transport, TravelingItem item, TileEntity tile);
}

View file

@ -363,12 +363,13 @@ public class PipeTransportItems extends PipeTransport {
} else if (!item.toCenter && endReached(item)) {
TileEntity tile = container.getTile(item.output);
boolean handleItem = true;
if (travelHook != null) {
travelHook.endReached(this, item, tile);
handleItem = !travelHook.endReached(this, item, tile);
}
// If the item has not been scheduled to removal by the hook
if (items.scheduleRemoval(item)) {
if (handleItem && items.scheduleRemoval(item)) {
handleTileReached(item, tile);
}

View file

@ -91,7 +91,8 @@ public class PipeItemsLapis extends Pipe<PipeTransportItems> implements IItemTra
}
@Override
public void endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
public boolean endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
return false;
}
@Override

View file

@ -50,6 +50,7 @@ public class PipeItemsVoid extends Pipe<PipeTransportItems> implements IItemTrav
}
@Override
public void endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
public boolean endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
return false;
}
}