use of logisticspipes.proxy.interfaces.IFuzzyRecipeProvider in project LogisticsPipes by RS485.
the class ModuleCrafter method importFromCraftingTable.
public void importFromCraftingTable(@Nullable EntityPlayer player) {
if (MainProxy.isClient(getWorld())) {
// Send packet asking for import
final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteImport.class).setModulePos(this);
MainProxy.sendPacketToServer(packet);
} else {
final IPipeServiceProvider service = _service;
if (service == null)
return;
service.getAvailableAdjacent().neighbors().keySet().stream().flatMap(neighbor -> SimpleServiceLocator.craftingRecipeProviders.stream().filter(provider -> provider.importRecipe(neighbor.getTileEntity(), dummyInventory)).map(provider1 -> new Pair<>(neighbor, provider1))).findFirst().ifPresent(neighborProviderPair -> {
if (neighborProviderPair.getValue2() instanceof IFuzzyRecipeProvider) {
((IFuzzyRecipeProvider) neighborProviderPair.getValue2()).importFuzzyFlags(neighborProviderPair.getValue1().getTileEntity(), dummyInventory.getSlotAccess(), fuzzyFlags);
}
});
// Send inventory as packet
final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteImportBack.class).setInventory(dummyInventory).setModulePos(this);
if (player != null) {
MainProxy.sendPacketToPlayer(packet, player);
}
MainProxy.sendPacketToAllWatchingChunk(this, packet);
}
}
Aggregations